cancel
Showing results for 
Search instead for 
Did you mean: 

OpenCL

peng
Journeyman III

Valgrind reported memory leak when running OpenCL sample.

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

0 Kudos
Reply
10 Replies
binying
Challenger

Re: Valgrind reported memory leak when running OpenCL sample.

CplusplusWrapper in APP SDK 2.8

   -- I use APP profiler integrated in vs2010. It doesn't report a memory leak...

0 Kudos
Reply
peng
Journeyman III

Re: Valgrind reported memory leak when running OpenCL sample.

Hi

Maybe it is the problem of Valgrind. Can APP profiler check the memory leak? I don't find this feature. I am using the OpenCL implementation of AMD for CPU on Linux. Can you test the sample on Linux?

Thanks!

0 Kudos
Reply
binying
Challenger

Re: Valgrind reported memory leak when running OpenCL sample.

I am not sure how reliable APP profiler or a tool such as Valgrind is when it comes to detect memory leak...

0 Kudos
Reply
bpurnomo
Staff
Staff

Re: Valgrind reported memory leak when running OpenCL sample.

You can use the AMD CodeXL tool (GPU Profiler component) to detect in your application whether it has released opencl objects correctly (through the Warning/Error messages feature in the Summary pages panel).

se6
Journeyman III

Re: Valgrind reported memory leak when running OpenCL sample.

I also noticed a while ago that any OpenCL prog with the AMD APP SDK is not valgrind clean. That is quite bad and a bit worrying. I only wish AMD would improve this.

Regards,

Se6

0 Kudos
Reply
gouse
Journeyman III

Re: Valgrind reported memory leak when running OpenCL sample.

Catalyst drivers 12.10 and 12.11.Beta show memory leaks. You can run SimpleConvolution, MatrixTranspose or other samples to see memory use increasing. The memory increase has sporadic behavior. It can increase and then fall down, then increase again and go up till application crashes in the end. I don't know what happens in peng's case, but he uses SDK 2.8 it most likely one of those latest versions. So, guys, please fix it asap. In any case, my system is Win7, 32-bit, Cayman V7900.

Regards.

0 Kudos
Reply
heman
Adept II

Re: Valgrind reported memory leak when running OpenCL sample.

Hi,

Some time back, valgrind was known to be reporting false positives for memory leaks related to opencl objects.

bpurnomo's suggestion may be useful in that case.

gouse,

I hope you are running the samples you mentioned in a loop using some scripts. Can you tell how can I reproduce this increase in memory at my end.

gouse
Journeyman III

Re: Valgrind reported memory leak when running OpenCL sample.

Hi heman,

I just ran different specified samples as is (meaning no scripts used), with data size -x & -y and '-i' parameters big enough to keep sample running for half a minute or so to have a time to track the memory usage in task manager or process explorer.

Now, obviously, it can't be a general problem, but some rather "local" installation/OpenCL driver/driver/asic- specific. Whatever it is, it shouldn't happen, this is all "of-the-shelve" and not house-made products 😞

0 Kudos
Reply
heman
Adept II

Re: Valgrind reported memory leak when running OpenCL sample.

Hi gouse,

I tried running matrixtranpose, matrixmultiplication and simple convolution for minutes(1000 iterations with large matrices) on one windows and one linux machine, but did not saw any increase in memory usage of the samples.

I was using SDK 2.8 and catalyst 12.10

Can you please provide, a way to reproduce the problem.

0 Kudos
Reply