[RFC]Proposal for better garbage collection

Sean Kelly sean at invisibleduck.org
Wed Feb 22 15:05:38 PST 2012


On Feb 22, 2012, at 10:56 AM, Benjamin Thaut wrote:
> 
> 5) pointer / reference changed callback
> 
> Every time a pointer / reference is changed the D compiler emits a call into the runtime and passes the new value of the reference / pointer with it.
> 
> void _d_pointerChanged(void *ptr);

D can call assembler, C routines like memset(), plain old opaque C library code, etc.  What should the D compiler do in light of all the sources of memory changes that it can't monitor?

> 6) Different interface for the GC
> 
> The current interface to the GC would have to change because the "this block of memory might contain a pointer" approach wouldn't work anymore. For example a block of memory and a delegate which iterates over all pointers within the memory block could be used for user allocated memory blocks. There should be a separate allocator function provided by the GC that allocates memory that does not get moved around so it can be used to pass it to non garbage collected code.

I posted a suggested new GC interface do the runtime mailing list 6 or so months ago.  In short, I do think the current interface is lacking.  Also, CDGC does support precise scanning and runs with Druntime.  The big problem there is that CDGC is based on the Tango GC (where Druntime's GC originated) and someone needs to review all the GC changes since the Druntime project was created to see what may need to be merged into CDGC.  I started on this once, but it turned out to be more work than I had time for.


More information about the Digitalmars-d mailing list