While working with similar tools recently in Objective-C, you might want to find a heap tool. The heapshot tool will take snapshots of your heap, build a memory graph, and try to figure out which one is rooted and where. Most of this is similar to how the garbage collector detects which objects to collect.
In general, the heap tool allows you to take pictures of your heap at different times and compare which memory is rooted and which objects occupy this space. Mono Heapshot https://github.com/mono/heap-shot seems like a good starting point here, although I have not used it personally. I have had good results with JetBrains dotTrace memory in the past. Unfortunately, both of these tools do not show you the generations in which the object lives, but they can track the identification of the object, sometimes even in snapshots. If you find that an object survives from several collections, it is likely to live in a higher generation. The exact generation is implementation, runtime, and environment, though.
Memory profiles often exist. A very good tool for the Microsoft CLR is the WinDbg and SOS extensions. There is a good msdn magazine article here: http://msdn.microsoft.com/en-us/magazine/cc163528.aspx , and I found Tess from (wonderfully titled) "If it is broken, fix it you should" the blog has great content also. http://blogs.msdn.com/b/tess/
Some general information about your heap structure and GC generations can be obtained using the set of performance counters documented at http://msdn.microsoft.com/en-us/library/x2tyfybc.aspx .
source share