[Mono-list] Mono memory usage grows but application memory looks stable

Manuel C. wtesto at zero.undo.it
Sun Aug 2 16:52:42 EDT 2009

I'm working on a long running application without GUI. My problem is, that
mono uses an increasing amount of memory until it crashes after ~2 weeks. 

Here is a example output of "top" after a few days:

26225 xxxx      16   0  5360 1540 1336 S    0  0.0   0:00.01 bash
 1478 xxxx      16   0  373m 151m 6088 S    0  1.9   0:35.80 mono
  608 root      18   0 23284 7968 4760 R    0  0.1   0:00.07 apache2

My first thoughts were some kind of memory leak caused by me. To track them
down I downloaded the trial version of ANTS Memory profiler for Windwos and
tracked the memory consumption over a few hours. Surprisingly there was no
memory leak. The Process started with ~20mb of virtual memory, the real
memory usage was the whole time less than 1mb. The virtual memory did also
not increase the whole time.

To get an approximation of the real memory used by my application running
with mono, I logged the return value of "System.GC.GetTotalMemory(false)".
It is stable while the memory consumption by the mono process increases.

I don't know what to try now... Has anyone a hint or tip? Please ask if you
need more information.

Some additional information:

Because I work under Windows XP, my C# code is written and built with Visual
Studio 2008 Express Edition. The production environment is a VPS with Debian
Etch and Mono version 1.9.1 from http://debian.meebey.net/etch-backports.
The VPS is a 64-bit system.

"uname -a"
	Linux xxxxxx 2.6.18 #1 SMP Fri Dec 12 06:15:44 UTC 2008 x86_64 GNU/Linux

"mono -V"
Mono JIT compiler version 1.9.1 (tarball)
Copyright (C) 2002-2007 Novell, Inc and Contributors. www.mono-project.com
	TLS:           __thread
	GC:            Included Boehm (with typed GC)
	SIGSEGV:       altstack
	Notifications: epoll
	Architecture:  x86
	Disabled:      none

Application details:
- built with .Net 2.0 as target framework
- creates many shortliving TCP-clients (like a HTTP client)
- uses generic lists with own classes
- small built-in-HTTP-server
- 2 main threads, one for the main loop, the other for the HTTP- server

View this message in context: http://www.nabble.com/Mono-memory-usage-grows-but-application-memory-looks-stable-tp24782014p24782014.html
Sent from the Mono - General mailing list archive at Nabble.com.

More information about the Mono-list mailing list