[Mono-dev] sgen garbage collector/unmanaged resources/multi-thread issue

Rodrigo Kumpera kumpera at gmail.com
Fri Feb 11 10:34:07 EST 2011

Mono doesn't take memory pressure into account. This is probably
what's happening.

On Fri, Feb 11, 2011 at 3:54 PM, matteo tesser <matteo.tesser at gmail.com>wrote:

> Hello,
> I have a concurrent programming test  which during 5-10 minutes
> creates and releases a  lot of objects which use unmanaged memory.
> Every managed object,  respectively  allocates/deallocates the
> unmanaged memory using  Marshal.AllocHGlobal and Marshall.FreeHGlobal
> methods  and uses GC.AddMemoryPressure/GC.RemoveMemoryPressure to tell
> to  the garbage collector the presence of the additional memory.
> I experienced some memory problems on linux,  so I did several tests:
> 1)  In linux machine with openSuse 11.3 64bit dual core with  mono
> 2.8.2,  the program launched with mono --gc=sgen eats 4GB of RAM in
> about two minutes (see attached screenshot).
> If I launch the test by specifying the use of  boehm gc,  the memory
> is still consumed but at smaller rate.
> I tried the test also with mono 2.10p3 and the behavior is the same
> (also using MONO_GC_PARAMS=stack-mark=precise)
> 2) In Windows/.NET the memory footprint  of the program is constant on
> time:  80MB,
> 3) in a dual core mac os x ( with mono 2.10p2) the behavior is the
> same as windows.
> 4) In a Virtual Machine with  linux openSuse 11.3 32bit  and 1
> processor  , mono 2.10p3 the test works fine: the memory footprint  is
> constant at 50MB
> My conclusion is that the problem is restricted to the linux /
> multi-thread case.
> Are you aware of such issues on sgen?
> I tried to build-up a simple code reproducing the problem but I did
> not managed to do it with a simple test case, in case are you
> interested in a binary test case?
> Thanks,
> Matteo
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20110211/b7d99586/attachment.html 

More information about the Mono-devel-list mailing list