On 11/20/2009 08:25 AM, Alexander Smirnov wrote:
> But how GC knows when to free such objects? When it frees such objects?
> 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
> }
>
> thanks
>   

You might find this article informative:
http://en.wikipedia.org/wiki/Garbage_collection_%28computer_science%29

The gist of it is that Mono's GC (which is just Boehm's GC) scans for
references to memory that it has allocated, so as long as your program
has pointers to these objects, the GC will not collect them.

Hope that helps,

Jeff

_______________________________________________
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to