AnsweredAssumed Answered

Valgrind reported memory leak when running OpenCL sample.

Question asked by peng on Dec 21, 2012
Latest reply on Jan 18, 2013 by himanshu.gautam

Hi,

Some definite memory leak errors were reported when using the Valgrind to check my OpenCL application . Then I tried the sample CplusplusWrapper in APP SDK 2.8 which got the same problem. The error messages are as follow.

==2863== 29,305 (18,720 direct, 10,585 indirect) bytes in 20 blocks are definitely lost in loss record 854 of 855

==2863==    at 0x4C2ABED: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)

==2863==    by 0x7C212AC: ??? (in /opt/AMDAPP/lib/x86_64/libamdocl64.so)

==2863==    by 0x677E9F9: ??? (in /opt/AMDAPP/lib/x86_64/libamdocl64.so)

==2863==    by 0x67823EC: ??? (in /opt/AMDAPP/lib/x86_64/libamdocl64.so)

==2863==    by 0x6739453: ??? (in /opt/AMDAPP/lib/x86_64/libamdocl64.so)

==2863==    by 0x6755A3D: ??? (in /opt/AMDAPP/lib/x86_64/libamdocl64.so)

==2863==    by 0x6726E82: clIcdGetPlatformIDsKHR (in /opt/AMDAPP/lib/x86_64/libamdocl64.so)

==2863==    by 0x5253171: ??? (in /opt/AMDAPP/lib/x86_64/libOpenCL.so.1)

==2863==    by 0x5255105: ??? (in /opt/AMDAPP/lib/x86_64/libOpenCL.so.1)

==2863==    by 0x52547DF: clGetPlatformIDs (in /opt/AMDAPP/lib/x86_64/libOpenCL.so.1)

==2863==    by 0x4081D1: cl::Platform::get(int*) (in /opt/AMDAPP/samples/opencl/bin/x86_64/CplusplusWrapper)

==2863==    by 0x40838D: cl::Context::getDefault(int*) (in /opt/AMDAPP/samples/opencl/bin/x86_64/CplusplusWrapper)

==2863==

==2863== 64,612 (4,680 direct, 59,932 indirect) bytes in 1 blocks are definitely lost in loss record 855 of 855

==2863==    at 0x4C292B8: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)

==2863==    by 0x8D8231A: ???

==2863==    by 0x67D1CA7: ??? (in /opt/AMDAPP/lib/x86_64/libamdocl64.so)

==2863==    by 0x6984914: ??? (in /opt/AMDAPP/lib/x86_64/libamdocl64.so)

==2863==    by 0x6865697: ??? (in /opt/AMDAPP/lib/x86_64/libamdocl64.so)

==2863==    by 0x6865898: ??? (in /opt/AMDAPP/lib/x86_64/libamdocl64.so)

==2863==    by 0x6782108: ??? (in /opt/AMDAPP/lib/x86_64/libamdocl64.so)

==2863==    by 0x67823E5: ??? (in /opt/AMDAPP/lib/x86_64/libamdocl64.so)

==2863==    by 0x6739453: ??? (in /opt/AMDAPP/lib/x86_64/libamdocl64.so)

==2863==    by 0x6755A3D: ??? (in /opt/AMDAPP/lib/x86_64/libamdocl64.so)

==2863==    by 0x6726E82: clIcdGetPlatformIDsKHR (in /opt/AMDAPP/lib/x86_64/libamdocl64.so)

==2863==    by 0x5253171: ??? (in /opt/AMDAPP/lib/x86_64/libOpenCL.so.1)

==2863==

==2863== LEAK SUMMARY:

==2863==    definitely lost: 24,192 bytes in 28 blocks

==2863==    indirectly lost: 70,673 bytes in 68 blocks

==2863==      possibly lost: 1,511 bytes in 6 blocks

==2863==    still reachable: 132,189 bytes in 869 blocks

==2863==         suppressed: 0 bytes in 0 blocks

 

Is this a problem of OpenCL implementation or misunderstanding of Valgrind?

Thanks!

My Machine: Core i5-2500K, OpenSUSE 12.2 64bit, AMD APP SDK 2.8

Outcomes