3 Replies Latest reply on May 19, 2011 11:27 AM by himanshu.gautam

    Properly cleaning up on failure?

    arsenm

      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?