View Full Version : Do host allocated buffers need to be manually deallocated?

08-22-2012, 05:32 AM
If a buffer is created with CL_MEM_ALLOC_HOST_PTR, does that buffer have to be manually deallocated, or is that automatically done inside of clReleaseMemObject when its counter reaches zero? Similarly, if I use the C++ API wrapper, would a buffer object going out of scope automatically deallocate the host allocated memory? I appreciate the help clarifying this for me.

08-22-2012, 07:56 AM
The buffer does not have to be manually deallocated. All you need to is release the buffer using clReleaseMemObject. When the cl_mem object is released by the OpenCL implementation the allocated data storage will also be freed.