2 Replies Latest reply on Apr 23, 2013 3:37 AM by LeeHowes

    C++ Wrapper Release ?


      Hi All,


      I need to release a cl::Buffer object and reallocate with different size during program execution. I have to declare it global to be available in other files and functions. Since cl::Buffer has not any direct desstructor, is it safe to use its parent (Wrapper) destructor? In other words: mycl_Buf.~Wrapper();


      If no, what is the safe method?

      Thanks in Advance


        • Re: C++ Wrapper Release ?

          You can just assign a new cl::Buffer with different size to your global one like so:

          mycl_Buf = cl::Buffer(...);

          Assign operator will take care of the rest.

          • Re: C++ Wrapper Release ?

            Yes, it all reference counts. That's the biggest benefit over using the C API, I think. You can pass objects around and the retain/release behaviour is automatic. Never call the destructors directly unless you really know what you are doing because it may end up being called again on object destruction.

            1 of 1 people found this helpful