[D-runtime] GC finalization hook?

Sean Kelly sean at invisibleduck.org
Thu Feb 16 11:05:12 PST 2012


Not currently.  Seems like it would be easy enough to add, though.

On Feb 16, 2012, at 9:36 AM, Alex wrote:

> Hi,
> 
> In a virtual machine I'm working on, D's GC is provided as one of the
> GC implementations a program can run under. This works great so far,
> but I've run into a little "issue": Finalization. I need a way to get
> a callback whenever a piece of memory is destroyed. I was thinking I'd
> use rt_attachDisposeEvent as suggested by Vladimir Panteleev, but we
> recently switched runtime objects to be D structs rather than classes
> (because classes impose two machine words in the header, which is
> extremely wasteful when we also have our own header with three (!)
> machine words). rt_attachDisposeEvent seems to only work with
> full-fledged monitor-capable Object instances.
> 
> So, is there any other way to go about this for plain pieces of memory
> allocated via GC.calloc()?
> 
> Regards,
> Alex
> _______________________________________________
> D-runtime mailing list
> D-runtime at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/d-runtime



More information about the D-runtime mailing list