I was using CodeXL to do some profiling and it kept saying:
Opencl Memory leak detected [Ref =1] Object created by clEnqueueNDRangeKernel
Eventually it was narrowed down to this line:
status = clEnqueueTask( myQueue, myKernel, 0, NULL, NULL) ; |
After changing it to:
status = clEnqueueTask( myQueue, myKernel, 0, NULL, &clEvent ) ; |
clReleaseEvent ( clEvent ) ;
The memory leak went away.
As per the specs, when passing in NULL no event object should be created, but it clearly was in this case.
I tried it on a 6950 and 280x, both using the 13.12 catalyst driver and they both have this issue.
Edit:
clEnqueueNDRangeKernel( myQueue, myKernel, workDims, global_work_offset,(const size_t *)global_work_size, local_work_size, 0, NULL, NULL) ;
If I use this instead of clEnqueueTask it also runs into the same problem with a memory leak, which can be solved the same way.
Hi,
Could you test it with latest Catalyst driver (Beta 14.3)?
Thanks,
-Sudarshan
The beta driver appears to have fixed the leak in clEnqueueNDRangeKernel but not in clEnqueueTask.
Hi,
I will forward this to the driver team.
Hi,
I ran the taskParallel code from (http://www.fixstars.com/en/opencl/book/OpenCLProgrammingBook/calling-the-kernel/) and there was no memory leak reported in CodeXL (v 1.4) on my HD 6520G machine with catalyst driver 14.100.0.0.
Please can you check with the latest driver and CodeXL and let me know your findings.
Regards,
Hi,
It turns out the issue with the reported memory leak in clEnqueueTask is actually a bug in CodeXL. CodeXL is not doing the right thing when tracing the clEnqueueTask API. We will try to get a fix in place for the next version of CodeXL.
Thanks you for reporting this issue.
Chris