[Mono-list] Embeding Mono. Memory management
Robert Jordan
robertj at gmx.net
Fri Nov 20 08:56:25 EST 2009
Alexander Smirnov wrote:
> But how GC knows when to free such objects? When it frees such objects?
It frees them, when no other managed reference is pointing
to them.
> Could GC free the object when I still need it?
> for example
>
> void func() {
> MonoString* str=mono_string_new (domain, "some text");
> /*
> could GC free str before "using str", if no, why?
> */
> // using str
> }
If you want to use "str" after func () in unwound, then
you have to obtain a gchandle for "str". See Mono's
mono_gchandle_* functions.
Robert
More information about the Mono-list
mailing list