Hooking the GC?
Vladimir Panteleev
vladimir at thecybershadow.net
Mon Jan 3 01:53:19 PST 2011
On Mon, 03 Jan 2011 05:34:55 +0200, %u <wfunction at hotmail.com> wrote:
> Is there any way to add a hook to the garbage collector in D, so that I
> can be
> immediately notified (for example) when an object is created?
FWIW, Diamond ( http://github.com/CyberShadow/Diamond ) hooks various GC
functions, but it's an ugly hack that breaks with multi-threaded programs
(and the module is D1 and x86-only). A better run-time solution (not
involving modifying Phobos/druntime) would need a instruction-length
disassembler.
--
Best regards,
Vladimir mailto:vladimir at thecybershadow.net
More information about the Digitalmars-d
mailing list