[Mono-devel-list] Garbage Collection problem

Jonathan Pryor jonpryor at vt.edu
Tue Sep 30 21:30:26 EDT 2003


This is just a guess, but I don't think this is easily solvable.

Unix platforms use sbrk(2) to allocate additional memory from the
Operating System.  I don't know of any mechanism to *release* the
allocated memory back to the OS.

Once memory is allocated for a process, there is no way (that I know of)
to release it.

Thus, even after a garbage collection, the GC heap may be fully
collected, even empty (i.e. containing no user-allocated objects), but
without a means for the OS to reclaim space, the actual memory used
*cannot* decrease.

Please correct me if I'm wrong.

 - Jon

On Tue, 2003-09-30 at 09:58, Jörg Rosenkranz wrote:
> Hi all,
> 
> We are developing a server application which creates and destroys 
> many objects during it's lifetime. Sometimes there is a heavy increase
> of memory consumption because many large objects are handled 
> simultanously. Running this application we recognized that the heap 
> size doesn't decrease after such a heavy load. There is nothing in 
> memory but memory usage is about 250 MB!
> 
> The attached sample demonstrates this behaviour:
> It creates many strings and causes a memory usage of about 30 MB.
> Running the sample in MS.NET after removing the references and 
> triggering garbage collection the heap is very small again. Running 
> under Mono/Linux the heap stays at 30 MB. The same applies to 
> physical memory usage of the process.
> 
> I think this behaviour depends on the different garbage collector 
> implementations (compacting/non compacting). What can be done to 
> work around this problem? Or is it a Mono bug?
> 
> Thanks in advance,
> Jörg.




More information about the Mono-devel-list mailing list