[Mono-devel-list] Garbage Collection problem
Miguel de Icaza
miguel at ximian.com
Thu Oct 2 11:33:45 EDT 2003
Hello,
> So is this a Mono/GC bug not releasing unused memory of the
> GC heap?
> I see another problem with non compacting GCs. Look at the
> following situation (# = used memory, _ = unused)
>
> ###_____________________________________________##
>
> When the garbage collector moves used blocks to fill gaps
> (like MS.NET) that's easily to resolve:
>
> #####_____________________________________________
>
> The Mono GC can never release the unused memory to the OS
> until all blocks after the unused region are collected by
> the GC too.
>
> I think this is a design problem of the GC used by Mono.
Not really, because in the example you show, what happens is that
Boehm's collector does unmap the pages.
Your criteria applies if allocation is just a simple "last byte
requested from the OS", but in fact the way Unix works, and the way the
Boehm GC work, is that they can allocate individual pages in the address
space. So when you have a hole in the memory like the first one you
showed, it will release the memory.
Now, it will only do it if the whole page is free, if the page contains
data, it wont be able to do it, and since there is no compacting, it
wont be able to move the data off.
Miguel
More information about the Mono-devel-list
mailing list