[Mono-dev] Memory usage differences between GC and OS

pablosantosluac at terra.es pablosantosluac at terra.es
Tue Oct 12 10:12:36 EDT 2010

Hi all,

I could have titled it "where my mem has gone?" too :P

I've been talking to Mark Probst today regarding some issues and
questions related to general memory usage.

We've been testing sgen for months now and we're currently moving our
internal production server to Solaris/SPARC & Mono/sgen
(MONO_GC_PARAMS=major=copying), after being able to complete our entire
PNUnit suite on SPARC.

Well, the point of the email is the following: something I've found
several times is a situation where GC.GetTotalMemory gives me something
like, let's say, 40Mb, then VIRT is something like 200Mb and RES is 80Mb.

Mark refreshed me that jitted and non-jitted code will be eating up
memory, then metadata and so on... and of course the GC internals with
things like free memory lists and so on. But, I think it would be great
for application developers to really understand how this is working and
where your memory is going, because the diff between 40Mb and 200Mb is
simply... huge!

Sometimes you find yourself calculating the mem your classes are going
to eat, to find out that you're "spending" more on the "uncontrolled"
part than the one you were carefully designing.

On Windows you can use things like Ants memory Profiler to help you
figuring out (and most of the time you encounter a HUGE free mem block),
but I think it would be great to understand it too on Mono and maybe
even be able to "tweak it" somehow...

Boehm GC had the drawback of being unable to free VIRT mem (something we
had to fight several times ourselves with Plastic and huge servers), but
fortunately that's not the case with sgen, but we still end up with big
differences between what "gc thinks" and what "OS thinks".




More information about the Mono-devel-list mailing list