cameron314 / concurrentqueue

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

Release queue memory without calling destructors #360

Closed bear24rw closed 1 year ago

bear24rw commented 1 year 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 1 year ago

Don't destruct the ConcurrentQueue then :-)

bear24rw commented 1 year ago

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