Memory Management


I’m new to OpenCL and I’m trying to realize audio signal processing on my NVIDIA GPU.

I wrote an Algorithm, that works fine, but I’ve got the problem that my Plugin allocates new RAM during Runtime (although signal processing is done on the GPU) and does not release it. Because of that my plug in crashes after a minute because there is no RAM left to allocate.

I’m getting the input samples from the soundcard in blocks of 128 samples (float) - copy them to a created cl_mem buffer (with CL_MEM_ALLOC_HOST_PTR) by calling clEnqueueWriteBuffer - feed the cl_mem obj to my kernel and copy the output of the kernel (cl_mem) to my float output pointer by calling clEnqueueReadBuffer.

Now my question is: Does anyone have an idea why my plugin allocates RAM during the runtime and does not realease it? I have no idea :(

Thanks for your help.

I solved the problem! When I first started to use the OpenCL commands I copied them from an example, which I found on the internet. In there they used events to wait for for synchronization. I coded my project without events, but the event to wait for was left in the command.
Now I inserted “NULL” instead of “&events (cl_event)” for the last parameter of the clEnqueue… commands and it works without allocating memory during runtime.