Properly cleaning up on failure?

Discussion created by arsenm on May 16, 2011
Latest reply on May 19, 2011 by himanshu.gautam

I recently found that I have a bunch of code in my CAL application to manually clean up all buffers and such when anything fails that doesn't need to exist. I found that calShutdown() cleans up any allocated resources for you. I then was wondering if the same was true with OpenCL contexts. The documentation states for clReleaseContext():


After the context reference count becomes zero and all the objects attached to context (such as memory objects, command-queues) are released, the context is deleted.

Does clReleaseContext deref all of the associated resources so that supposing you haven't reffed any of the resources somewhere they will be destroyed immediately, or do you need to explicitly release them?