mirror of
https://github.com/boostorg/compute.git
synced 2026-01-28 07:02:15 +00:00
This fixes a few memory handling issues between device_ptr, buffer_iterator, buffer_value, allocator, and malloc/free. Previously, memory buffers that were allocated by allocator and malloc were being retained (via clRetainMemObject() in buffer's constructor) by device_ptr, buffer_iterator and buffer_value. Now, false is passed for the retain parameter to buffer's constructor so that the buffer's reference count is not incremented. Furthermore, the classes now set the buffer to null before being destructed so that they will not decrement its reference count (which normally occurs buffer's destructor). The main effect of this change is that objects which refer to a memory buffer but do not own it (e.g. device_ptr, buffer_iterator) will not modify the reference count for the buffer. This fixes a number of memory leaks which occured in longer running programs.