On Sun, 02 Jan 2011 22:34:55 -0500, %u <[email protected]> wrote:

Hi,

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?

(I'm aware that this could cause infinite recursion/deadlock if I try to
allocate memory, but that's all right, I'm fine with that.)

Thank you!

If you want to hook the GC, you probably have to add your own code to the GC.

Start with _d_newclass in druntime's src/rt/lifetime.d

-Steve

Reply via email to