[Mono-osx] Objective-C and Mono's GC

Martin Smith martin.smith.jr at gmail.com
Thu Jan 15 15:00:28 EST 2009


Hey Guys,

Thanks for the pointers (pun intended). The mono_gchandle api is exactly
what I was looking for. With that i can just mono_gchandle_new whenever we
store the pointer and mono_gchandle_free in the dealloc or reassignment of
the pointer.

Thanks again!
Martin

On Wed, Jan 14, 2009 at 9:25 AM, Andreas Färber <andreas.faerber at web.de>wrote:

> Hello,
>
> Am 13.01.2009 um 21:10 schrieb Martin Smith:
>
>  We are working on an application where we're embedding Mono in an
>> Objective-C application.  One of the issues that we're seeing is that if the
>> GC does not "see" pointers that are stored in Objective-C objects.  The side
>> effect is that when we run our applications, the Obj-C objects will have
>> instance variables that will eventually raise a SIGSEV
>> (NullReferenceException) whenever the garbage collector runs.
>>
>> Does anyone else have experience with this problem?  I know one of the
>> things we could probably do is maintain a data structure that stores all the
>> "live" mono pointers and then write smart pointer classes that explicitly
>> maintained ref counts on these objects, but I'm wondering if there's an
>> easier way.
>>
>
> I have successfully used GC handles from Cocoa, locking and obtaining a
> pointer only when necessary.
>
> Locking only when needed is important for the future "sgen" collector,
> which can thus move the objects around while they are not locked.
>
> Andreas
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-osx/attachments/20090115/2d58565f/attachment-0001.html 


More information about the Mono-osx mailing list