Jan 15 2010

Visualizing Runtime Object Graphs

One of the first questions people seem to ask when they see the Dependency Graph features of Visual Studio 2010 is whether it can also be used to visualized runtime object graphs.

In this Video (WMV, or MP4) I will show you how that can be done using the SOS debugger extensions and specifically the GCRoot command.  I've used this technique several times to help figure out some really complex memory leak bugs and so I'm confident you will find this to be a useful tool to add to your toolbox of tricks.

The code for the GCRootToDGML tool is available to download so you can try this out yourself, it should work with any recent version of Visual Studio 2010.

Adding links some excellent work done by others on this subject below:

Comments

11/2/2009 9:08:02 PM
Pavan. United States
Pavan.
Great post! Is ther a way to automate the "dump gcroot output to .log file and then manually run your program". Is there a way to spawn it from the immediate window itself?

Thanks,
Pavan.
11/4/2009 11:15:51 AM
Chris Lovett
Chris Lovett
I don't know the answer to your questions, but you are right, this is exactly the next step. Let me know if you find a solution Smile
11/7/2009 4:19:39 PM
trackback
Amazing .NET Reference Visualizations

Half the battle when tracking down memory problems in a .NET application is seeing the reference chain
11/8/2009 9:41:08 PM
Aaron Marten
Nice!
11/12/2009 7:24:32 AM
Jandeep United States
Jandeep
Awesome post ! link to the Video is broken ..can you fix it?
thanks
11/13/2009 6:59:39 AM
Chris United States
Chris
I added mp4 videos (slightly smaller) with links to screencast.com which should help.
1/1/2010 5:00:14 PM
Gregory Babski South Africa
Gregory Babski
Nice work! I noticed in your video you felt forced to use !dumpheap to get the address of your player instance. You should be able to get it directly at the breakpoint you set with (in the immediate window):
&player
Which returns
0x0040ef2c
    player: 0x02669088
The nested address being the one of interest.

This works in VS2008 - not sure if it still does in VS 2010.
1/9/2010 6:24:52 AM
Martin Connell United Kingdom
Martin Connell
Thanks for the interesting video and the DGML visualizer looks quite sexy; but isn't your advice to watch out for object reference cycles kind of ironic given .NET/CLR was originally pushed as a solution to such woes?

Indeed, it might even bring a wry smile to the face of anyone who has stuck with C++ and stubbornly resisted the lure of neglecting the object reference graph at the design stage.
3/12/2010 11:00:12 PM
Robert
Thanks for the video. I've been wanting to implement a object reference graph, but had a few questions on some issues I was seeing. You covered it all in the video. Thanks again.
3/20/2010 12:03:56 AM
James
Just wanted to say thank you for the video on visual studio 2010, i've never used the sos debugger plugin before and it came in handy. Cheers!
4/11/2010 12:38:22 PM
Andre Gemmen
Great stuff my friend!  Visualizing Runtime Object Graphs was a wonderful read. Love reading stuff about this.
4/22/2010 12:42:42 AM
Calpe Villas
nice post.. I especially like the code to GCROOTtoDGML tool
6/5/2010 10:54:45 AM
Julio Rapko
"Simplicity is not the opposite of complexity. Simplicity is too often an excuse for being simplistic. The world doesn't need any more stupid software. The opposite of complexity is beautiful, elegant design."

I agree, for I have noticed that some software, especially computer games, are beautifully stable, while others crash like there is no tomorrow.
6/5/2010 5:07:29 PM
Jordan retro 10
I only lately started out leaving comments! Makes me think a small way more about what I enjoyed and learned in regards to the post! Superb tips, thanks!
6/6/2010 5:18:08 PM
Aurea Gillen
great job on the videos. i really enjoyed watching them. keep up the good work...
6/14/2010 4:52:30 PM
car hire france airport
great job on the videos. i really enjoyed watching them.keep going buddy.........
6/17/2010 3:09:53 PM
Mark
The Videos are great. Thx for this useful tip with the sos debugger.

ciao from germany
7/2/2010 5:42:28 AM
Money Origami
Great post by videos. I especially like the videos. I especially like the code to GCROOTtoDGML tool
7/2/2010 7:10:26 AM
projector lights
Nice post i just wants to offer my thaks for the video on visual studio 2010 . Infact i love to know more about this.
7/3/2010 6:27:28 AM
Ultimate WOW Guide Review
Cheers for the awesome video, the visualizer, and the code to GCROOTtoDGML tool is tidy. I've been searching for an object reference graph. You've covered everything I think. Cool.
7/6/2010 4:35:50 AM
Florida Phone Systems
The visualized runtime object graphs are a great time saver when using the Dependency Graph features of Visual Studio 2010.  However, they are definitely difficult to use, and I appreciate the guide.
7/19/2010 5:36:51 PM
Money Origami
It great to know about visualized runtime object graphs as they are great time saver when using the Dependency Graph features of Visual Studio 2010. Thanks for great information about Visual Studio 2010.
7/20/2010 7:29:09 AM
Greener Life
Thanks for nice tutorial!
7/20/2010 9:51:47 PM
house extension costs
I love visualising runtime graphs now after your article, cheers.
7/20/2010 9:51:49 PM
Father's Day Gift Ideas
Excellent! Ive now added GCRootToDGML to my tool collection. Thanks for upping the link location.
7/21/2010 4:43:41 AM
Enclosed cargo trailer
Great post! Is there a way to automate the production program. Is there a way to spawn the immediate window itself?
7/21/2010 8:28:35 PM
Low Cost Auto Insurance
Thanks for the video. I've been wanting to implement a object reference graph and you made it so simple to understand.  just wanted to let you know your help is really appreciated.
7/26/2010 7:32:50 PM
Soccer
Thanks for posting your video.  

It is so much easier to understand by watching rather than reading.
7/27/2010 6:59:28 PM
what is neuropathy
This was really very helpful information. I really appreciate everything.
7/28/2010 2:36:39 AM
Boat trailer wheels
Thanks for the interesting video and the DGML visualizer looks quite good.
7/29/2010 5:23:28 AM
roger t
Thanks for the interesting video. Learning to use GCRootToDGML hasn't been easy!
7/30/2010 12:02:21 AM
diets for quick weight loss
Good post. I bookmarked this website
7/30/2010 8:29:03 AM
Opony
Thanks for good article. Hope to see more soon.
7/30/2010 10:39:53 PM
saint paul computer repair
Great video!  It really helped me a lot.
7/31/2010 3:56:20 PM
Web Design Inspiration
Awesome post, can I link to this from my website?
8/1/2010 6:18:36 AM
puppy potty training
Extremely amazing post. The author has given a perfectly explain how to visualize Runtime object graph. Thank you for sharing this update. We will be waiting for more exciting post.
8/2/2010 7:44:15 PM
QQ Senegal
QQ
now added GCRootToDGML to my tool collection. Thanks for upping the link
8/5/2010 6:57:49 AM
disability insurance
This great information. It seems like I have been dealing with this problem more and more lately, and the information you provide has been incredibly helpful.
8/6/2010 4:33:06 AM
Universal Studios Tickets
Thanks, now off to play with the SOS debugger..
8/6/2010 5:50:13 AM
Rosh
This is really great info. Thank you for sharing it with us!
8/6/2010 11:44:09 AM
Schildersbedrijf Rotterdam
I didn't think about visualizing this. It sure looks like a great tool to help track down bugs!
8/7/2010 8:29:53 PM
Roger Gordon
Thanks for posting your video. the information is very useful.
8/10/2010 8:32:17 AM
Edwin
Thanks I was looking into GCRoot and your video helped me a bit more on my way
8/20/2010 6:56:32 PM
ice vending man
Is ther a way to automate the "dump gcroot output to .log file

Add comment



(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading