[Mono-list] Heap-Shot with no GUI.

Paolo Molaro lupus at ximian.com
Thu Nov 18 14:45:17 EST 2010


On 11/18/10 Esben Laursen wrote:
> Allocation summary
>       Bytes      Count  Average Type name
>   378194872      83939     4505 System.Byte[]
[...]
> It looks like its the "System.Byte[]" type where I have my leak. However 
> is there someway that I can see what methos or class that is originates 
> from? I use Bytes[] several places, but I cannot seem to find the place, 
> as I only use them inside methods that should be destroyed my GC when it 
> has finished.

You have an allocation summary, so you can see where the arrays were
allocated with:

	mprof-report --traces output.mlpd

By default this info is not printed to not clutter the output.
If, instead, you want to know where those objects are referenced from,
you need to profile in heapshot mode, for example, about every 2 seconds:

	mono-sgen --profile=log:heapshot=2000ms yourprogram.exe

and then the usual:

	mprof-report --traces output.mlpd

For each heapshot, if you're retaining memory to these arrays, you
should see their count/size increasing and a list of types whose
objects reference the arrays (if you're using mono from current git
you should also get info if the arrays are pinned or referenced from
some other non-object root).

lupus

-- 
-----------------------------------------------------------------
lupus at debian.org                                     debian/rules
lupus at ximian.com                             Monkeys do it better


More information about the Mono-list mailing list