Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
Announcements
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.
15329 Discussions

Memory leaks in OpenCL host

Altera_Forum
Honored Contributor II
967 Views

I work in big project with OpenCL part. 

In cyclic data processing many calls of OpenCL functions leaves memory leaks, common memory size of program in Program Manager grows and grows, speed is slower and slower... 

All our call to malloc() (and other memory allocation routines) have a corresponding free(). 

I use "Diagnostic Tools" / "Memory Usage" from Visual Studio 2015-2017. 

After each cycle in debuggable program I make snapshot, him shows +180, +130,+80 new allocated blocks in comparison with previous snapshot. 

If I see all new allocated blocks, all have "Undetermined type" and mainly stored call stack from us to "alteracl_icd.dll" and to "ntdll.dll", size of block 7400 bytes. I try many versions of "OpenCL.lib" / "OpenCL.dll" -- leaks is leaved. 

This leaks visual appears in calls to "clFinish()", "clEnqueueReadBuffer()", "clEnqueueNDRangeKernel()", "clEnqueueTask()", "clEnqueueWriteBuffer()" -- all queue functions. Is it possible to free in OpenCL queue work results ? 

In our Altera Cyclone V kit this host program also works 3-5 times and stops on memory shortage. 

May be it a lack in Altera libs or our bug ?
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
121 Views

Are you using OpenCL events? Pretty much all OpenCL object also have their associated memory overhead and respective reelase function. You might want to look into the "clRelease" family of functions.

Altera_Forum
Honored Contributor II
121 Views

Thank You, HRZ ! 

An events returning from queue functions and "malloced" inside OpenCL.dll by 7400 bytes, was not released. 

Big Thanks ! 

 

P.S. May be Altera make in their OpenCL SDK a function returning statistic about all allocated objects, what need to be released ?
Reply