GC for pure functions -- implementation ideas

Steven Schveighoffer schveiguy at yahoo.com
Mon Apr 18 05:27:25 PDT 2011


On Sun, 17 Apr 2011 14:08:29 -0400, Michel Fortin  
<michel.fortin at michelf.com> wrote:

> On 2011-04-17 05:22:10 -0400, Fawzi Mohamed <fawzi at gmx.ch> said:
>
>> All this comes back again to having several pools, showing how useful
>> such a primitive is.
>
> Speaking of rethinking the GC and its primitives, is there a way  
> currently to tell the GC to track pointers to a manually allocated block  
> and assign a callback for when the GC wants that block to be finalized  
> and deallocated? I'm kinda going to need that if I am to bring decent  
> garbage-collected Objective-C objects in D.
>

It's coarsely grained, but you can intercept all finalization calls:

http://www.digitalmars.com/d/2.0/phobos/core_runtime.html#collectHandler

You'd have to figure out some way to filter only the ones you care about.

-Steve


More information about the Digitalmars-d mailing list