[Mono-list] calling a delegate from unmanaged code to managed code

Jonathan Pryor jonpryor at vt.edu
Mon Apr 10 06:51:05 EDT 2006

On Mon, 2006-04-10 at 13:44 +0800, GaoXianchao wrote:
> Can this prevents the garbage collector from *moving* the delegate
> object in memory?

There are two separate things, actually.

There's the managed delegate instance.  This can be moved around memory
by the GC.

There's also the unmanaged function pointer, created by the runtime to
do the transition from unmanaged to managed and invoke the appropriate
managed method.  This function doesn't move, and the memory for it will
only be reclaimed when the delegate instance is reclaimed.

 - Jon

More information about the Mono-list mailing list