+ 0 - 0 | § ¶Shooting memory
Heap-shot is a new memory profiler I've been working on. I used this profiler in the last MonoDevelop release to track down memory leaks, and it turned out to be really useful. So the idea is the following: you start a mono application using the heap-shot profiler like this:> mono --profile=heap-shot myapp.exeThen you start the heap-shot tool by just running:
> heap-shot-guiWhen the application is running, click on "Memory snapshot" and select the process you just started. At this point, heap-shot will make a snapshot of the process memory and will load it into the heap-shot tool. You'll see then two tabs: one shows a summary of the snapshot (number of objects and total managed memory), the other tab shows a list of types, and for each type the number of instances, the total memory size and the average size. The list of types is in fact a tree of references. By expanding a type you'll get a list of types referenced by that type. If you want to examine a type in detail, you can double-click on the type name and it will show the type subtree in a separate tab.
It is also possible to see inverse references, that is, see what objects reference objects of a given type. For example, if your app has 2000 int arrays in memory and you want to see what is holding all those int[], just click on the "Inverse references" checkbox and expand the int[] node. You can keep expanding as many levels as you want, what you'll see is something like this:
heap-shot can also show differences between two snapshots (that is, which objects have been allocated between two snapshots). To use this feature just take two snapshots, click on the checkbox of the snapshot you want to use as base snapshot, and then select the second snapshot. All information you'll now see in the references tabs will be about newly allocated objects only.
You can get heap-shot from SVN (module name: heap-shot). The README file has some more information. Enjoy!