System:
Linux 3.2.0-4-amd64 #1 SMP Debian 3.2.57-3 x86_64 GNU/Linux
NVIDIA Driver for Linux X64 version 340.32
Tesla K20 and K40
Issue:
There is a memory leak in the host system (not on the gpu) when calling clCreateSubBuffer, even if the memory object is released. Enough calls exhausts memory and crashes the program.
Steps to reproduce:
Here’s a github repo that will reproduce the leak: https://github.com/pjreddie/opencl_memory_leak
The leak appears from this specific section:
while(1){
cl_buffer_region r;
r.origin = 0*sizeof(float);
r.size = 100*sizeof(float);
cl_mem sub = clCreateSubBuffer(mem, CL_MEM_READ_WRITE, CL_BUFFER_CREATE_TYPE_REGION, &r, &info.error);
check_error(info);
info.error = clReleaseMemObject(sub);
check_error(info);
}
I’ve tested this on a machine running the AMD OpenCL drivers and they do not have this leak.