release a kernel in opncl-c++ binding


I have two kernel, and I set different buffers for each one of them, and I want to delete the buffers of the first kernel and free the memory before creating the buffers of the second kernel, how I can delete them ( I know how to do that in c using “clReleaseBuffer, clReleaseKernel” but how to do it in c++).

I’d suggest to dynamically create a buffer using “new” like

cl::Buffer* buf1=new cl::Buffer(/* args */);

and then free it later by deleting the object like

delete buf1;