On 2011-04-18 08:27:25 -0400, "Steven Schveighoffer" <schvei...@yahoo.com> said:

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

On 2011-04-17 05:22:10 -0400, Fawzi Mohamed <fa...@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.

Won't do. What I need is to make the GC track memory blocks allocated externally, with some callback telling me when they are no longer referenced.

I'll probably just add this capability to the GC myself when the time comes.

--
Michel Fortin
michel.for...@michelf.com
http://michelf.com/

Reply via email to