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

GaoXianchao gxcmaillist at gmail.com
Mon Apr 10 07:55:16 EDT 2006


2006/4/10, Jonathan Pryor <jonpryor at vt.edu>:
> 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
>
>
>

got it, Thanks very much!


More information about the Mono-list mailing list