Results 1 to 2 of 2

Thread: Memory management with cl.hpp

Hybrid View

  1. #1

    Memory management with cl.hpp

    I've been running a leak checker on my project and I get a lot of stuff originating out of OpenCL. That doesn't mean it's OpenCL's fault because I'm ultimately the one making these allocations. My question comes down to how I should handle the deallocation of these things. I have a few questions as I go but I wanted to start with one in particular.

    In cl.hpp as posted here:
    http://www.khronos.org/registry/cl/api/1.1/cl.hpp

    I see the Context object has a constructor that uses clCreateContext under the hood to create a handle to an OpenCL context. I don't see an OpenCL destructor. As far as leaks go, in the normal application I could probably just suck it up since I shouldn't be making these contexts left and right, but I sure throw them around like confetti in my unit tests. My leak checker goes nuts over it. I have some problems with platforms too that I think are related to the contexts, so I wanted to figure that out first. I'm asking first before I invite myself to tweak with my cl.hpp file and see what I get away with.

  2. #2
    Senior Member
    Join Date
    Oct 2012
    Posts
    115
    The Context class is derived from Wrapper<cl_context> which has a destructor that handles the release of the underlying OpenCL object.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •