cameron314 / concurrentqueue

A fast multi-producer, multi-consumer lock-free concurrent queue for C++11
Other
9.52k stars 1.66k forks source link

Release queue memory without calling destructors #360

Closed bear24rw closed 9 months ago

bear24rw commented 9 months ago

I have a concurrentqueue of shared_ptr's pointing to buffers. When my program terminates the concurrentqueue destructor calls the shared_ptr destructors which free all the buffers. It takes significant time to free all the buffers. Since the program is terminating I'd rather just release the memory without calling the destructors and let the OS reclaim it.

cameron314 commented 9 months ago

Don't destruct the ConcurrentQueue then :-)

bear24rw commented 9 months ago

Wildly obvious solution 😅 Simply constructing my queue with new instead of as a smart pointer works great :)