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

Zoltan Varga vargaz at gmail.com
Wed Jan 18 08:36:03 EST 2006


  If you are talking about the memory allocated by the script itself,
I think the best solution would be to explicitly generate code to
track it, i.e. for each newobj
or newarr IL opcode you emit, emit some statements to increase a counter or


On 1/18/06, Jim Purbrick <jimpurbrick at yahoo.co.uk> wrote:
> 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.
> ___________________________________________________________
> To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list

More information about the Mono-devel-list mailing list