[Mono-list] Status of Mono's garbage collector

Paolo Molaro lupus@ximian.com
Thu, 17 Feb 2005 12:17:11 +0100

A small update on this.

On 02/15/05 Paolo Molaro wrote:
> To fix some of these issues we also need to have libgc handle
> additions to the root set more gracefully (right now it has a fixed
> number of entries).

I implemented the code to make the number of root entries dynamic,
but after a few thousand libgc will assert because it doesn't
expect to have too many roots, I guess (probably the mark stack size 
needs to be tuned, too). This results by adding roots for the entries
in the runtime hash tables that contain objects, I started
implementing a different hashtable design that requires just a root
entry per hashtable: this moves the problem to when a few
hundred appdomains and dynamic re.emit images are created and active at
the same time, but it may be good enough for the loads libgc can
sustain, until we have our own GC.

> Fragmentation may be an issue, but I haven't investigated how much
> effect it has on heap size. My guess is that much of the issue
> with increasing heap size is because libgc prefers to increase the
> heap instead of being more aggressive at reclaiming memory (this
> is easily triggered by storing somewhat big arrays in objects with
> finalizers). There is probably some tuning or small fixes that need
> to be done in libgc to prevent this from happening.

I committed a fix for this issue yesterday: at least two tests that were
reported to increase memory usage until the process died are
now behaving quite well, with memory usage constant after a few requests.

At this point, people that had issues with the memory usage of mono apps,
especially xsp and server-side kind of workloads, should test again
with the current mono from svn and report their results.
The behaviour should be much better for all the workloads
and for some it should not be an issue anymore (meaning that,
when the max amount of memory to service the outstanding requests
has been reached, it should not increase over time, unless
many more requests need to be serviced at the same time).

Please do file bug reports about this issues with tests cases
we can use to reproduce. For mono 1.2 we may not be able to
have a perfect GC (because that requires a precise GC), but
we made several improvements and a few more are possible.



lupus@debian.org                                     debian/rules
lupus@ximian.com                             Monkeys do it better