[D-runtime] GC finalization hook?
Alex
xtzgzorex at gmail.com
Thu Feb 16 09:36:58 PST 2012
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
More information about the D-runtime
mailing list