Force Directed Heap Visualiser Help

If the the dump loads, but is not drawn, the probably cause is that there are too many objects. At present the code can handle up to aroung 500. So small console apps are ok, but large windows forms apps will be too much.

Reading the Graph

The graph shows a snap shot of the managed heap. Instance objects are represented with a piece of text declaring their class type. At present this is not confined to the source code you write, but also includes objects created by MsBuild, and other under the hood C# stuff. For instance there is an array of strings which may be a string interning pool.

The lines show references from one object to another. I.e. they connect the reference variable field of one object to the actual object to which it refers, or rather to a circle around it. By looking at which end of the line has the circle you can tell the direction of the reference - which object is referring to which. The lines are translucent, so reference lines where each object refers to the other are darker. The circles are darker where more than one object refers to the circled object.

Red lines come from objects that are immediately rooted in the stack. Green lines come from objects that have no listed parent in the dump. You can see some example screenshots here.

Getting the Son of Strike dump .xml from Visual Studio

  1. In Visual Studio 2012 Express, with a project loaded, make sure that the Enable native code for debugging option is checked in the project properties (PROJECT > YourProject Properties > Debug). If the option is disabled you might be in the process of debugging (i.e. with the code running). If so, stop the code to re-enable it. Save the properties by pressing CTRL + S or clicking the save icon.
  2. Set a breakpoint at the desired line of code by clicking in the dark grey column set on the left edge of the main code window. A red circle should appear.
  3. Run the program. When the breakpoint is hit, Visual Studio pauses execution and returns you to the code.
  4. You now need to open the Immediate window. If Visual Studio is in the default layout you should see the Call Stack window pinned open at the bottom right of the main window, and under it, the tab for the Immediate window. If not you can reach it from the tool bar by going to DEBUG > Windows > Immediate.
  5. In the Immediate window, type:
    .load sos
    This should load Son of Strike, and you should see this affirmation:
    extension C:\Windows\Microsoft.NET\Framework\v4.0.30319\sos.dll loaded
    Once Son of Strike is loaded, type in the command:
    !traverseheap –xml yourFilepath
    , specifying a valid filepath, filename and .xml extension as the last argument, e.g.:
    c:\myDump.xm
    You should see this affirmation:
    
                Assuming a uncorrupted GC heap.  If this is a crash dump consider -verify option
                Writing Xml format to file c:\myHeap.xml
                Gathering types...
                tracing roots...
                
                Walking heap...
                ...............................................................
                file c:\myDump.xml saved
              
  6. N.b. I had trouble running the traverseheap command more than one time without reloading Son of Strike. If you experience this try re-running the .load sos command, then the !traverseheap command immediately after.

Using the visualizer to view the XML

  1. Use the file picker in the top left hand of the screen to upload the Son of Strike XML dump file. The visualization should load and display automatically.
  2. Navigate the space with the keyboard:
                Shift + UP  = forward 
                Shift + DOWN = back
                Shift + LEFT  = left 
                Shift + RIGHT = right
                UP, DOWN, LEFT, RIGHT = rotate about x and y axes
              
N.b. The visualiser seems to work best with Chrome on the DBS machines. Also bear in mind Internet Explorer is often set to version 7 by default in DBS. If you are using Internet Explorer in DBS and get a JavaScript alert box warning that file upload is not supported try pressing F12 to go to the Developer Tools window, scroll down to Emulation, and make sure that Document mode is set to “Edge”.

Exporting a snapshot in Scalable Vector Graphics format

  1. Press F2. If the browser allows it, a new window should open displaying the SVG.
  2. Press CTRL + S or select "Save Page As", and save the file with an .svg extension.

Back to visualiser.

Nick Boon 2015 boonnick@hotmail.com