[Mono-list] lifetime of objects allocated with mono_object_new/mono_runtime_object_init

Robert Jordan robertj at gmx.net
Fri Jun 5 09:34:02 EDT 2009


ptr2009 wrote:
> hey all
> 
>     I have embedded mono in an Cocoa Application on Mac OS X. I was
> wondering how the life time management of CLR objects allocated with
> mono_object_new/mono_runtime_object_init is done ?
> 
>    I am seeing that objects seem to be collected by GC while the application
> is running ? Is this by design ?  

It's by design. Use mono_gchandle_new(), mono_gchandle_get_target()
and mono_gchandle_free() to prevent MonoObjects* from being GC.

Robert



More information about the Mono-list mailing list