[Mono-list] Embedded API. Numeric Boxing and GC

Rodrigo Kumpera kumpera at gmail.com
Wed Feb 26 23:18:36 UTC 2014


On Wed, Feb 26, 2014 at 12:58 PM, jonathan at mugginsoft.com <
jonathan at mugginsoft.com> wrote:

> On 26 Feb 2014, at 16:15, Rodrigo Kumpera <kumpera at gmail.com> wrote:
>
> > This code is wrong, it will fail when the object is moved since the
> gchandle is not pinning the target.
> >
> > Avoid pinning as much as possible since it does hurt performance a lot.
> >
> > The solution is to remove the monoObject field and use
> mono_gchandle_get_target against the GC handle.
> >
> Presumably objects are pinned by default when they appear in the stack.
> Yes?
>

Only in the C stack, but as soon as your (void)box:(long long)value method
finishes executing, no stack references
will be left.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-list/attachments/20140226/2eb5f269/attachment.html>


More information about the Mono-list mailing list