[Mono-dev] Re: [Mono-devel-list] Limiting Memory Allocation

Jim Purbrick jimpurbrick at yahoo.co.uk
Wed Jan 18 07:52:32 EST 2006


Hi Ben/Everyone,

--- Ben Maurer <bmaurer at ximian.com> wrote:
> Look at heap-prof. My profiler traps memory freed by
> the gc.

This is currently what I'm using to measure the memory
used by different scripts. I basically wrap calls to
the scripts in calls to the profiler which turn on and
off memory allocation monitoring. 

There are 2 problems with this approach:

1) When I deserialize a script the single call to
IFormatter.Deserialise allocates a lot of memory other
than the memory used by the script and a lot of those
objects don't seem to be GCed, so a lot of objects not
allocated by the script end up being counted towards
the script's memory usage.

2) I end up using a lot of memory to keep references
to every object allocated by the script so that when a
GC occurs I can iterate through the list and return
memory to the script for every object in the list
which has been collected.

Can anyone think of ways round these problems or
better ways to keep track of the memory allocated by
scripts? Given that I use serialization to move
scripts between appdomains and processes I wonder
whether just measuring the size of a binary
serialization of the script might be a close enough
approximation of its memory usage.

Cheers,

Jim.



	
	
		
___________________________________________________________ 
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com



More information about the Mono-devel-list mailing list