Altera_Forum
Honored Contributor
7 years agoMemory leaks in OpenCL host
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 ?