Garbage Collection

It came up in the Perth meeting last night that Delphi engineer Barry Kelly had experimented to some degree adding GC to Delphi.

It comes up in this episode of The Podcast at Delphi in 2008.

It links to the code publish on the (CodeGear?) website … now Embarcadero archives …

“A simple API unit for the Boehm GC, easy to use with classes needing finalization. Demo application, GC DLL, full source.”

and separately, in 2009 :

There is “Native Precise Tracking Garbage Collector”

by Henrick Hellström Email: Anonymous

Native precise tracking garbage collector for Delphi, based on a sweep-and-mark algorithm and lock-less linked lists, that can be used in either incremental mode or stop-the-world mode. It does not replace the built in memory manager, but supports memory block caching for faster allocation when used for classes that have roughly the same instance size.

The purpose of this garbage collector is to facilitate the implementation of complex structures where the ownership relations are unclear, where circular references make traditional reference counting unreliable, and where the structures are used and manipulated by multiple concurrent threads.

Supports Delphi 6 and up. (Delphi 4 and Delphi 5 are not supported, although the code could technically be modified to work with these compilers.)