Jens A. Koch

A conservative garbage collector for C/C++

I’m playing around with a conservative garbage collector for C/C++ written by Hans-J. Boehm, Al Demers and Mark Weiser.

The correct name is “The Boehm-Demers-Weiser Conservative Garbage Collector”.  It’s is a C malloc or C++ new replacement. It allows to allocate memory, without explicitly deallocating memory that is no longer useful. When the collector determines that the memory can no longer be otherwise accessed it is automatically recycled. It is also possible to use the collector only as a debugging tool to locate leaks and remove it completely from the end product.  This library is a sweet little gem with 20 years of creeping features, so be warned: Awesomeness ahead!!

Website: http://www.hboehm.info/gc/

And check out the tutorial slides (pdf): http://www.hboehm.info/gc/04tutorial.pdf

And if you don’t like garbage collectors at all, stay away and use explicit memory management (malloc/free or new/delete).

Take care 🙂

Comments Off on A conservative garbage collector for C/C++

Comments are closed.