views:

215

answers:

2

I habe a few million objects hanging around in memory. I want to find the gcroots for them so I need an object address. !DumpHeap however dumps all objects which is taking longer than i had the patience to wait. How can i limit its output to only one object address? I am using Visual Studio 2008 btw.

+1  A: 

Hi there.

Check out this page. It looks like you can use

-l X

to limit the number of items shown.

Cheers. Jas.

Jason Evans
This option seems to be unknown to Visual Studio. Maybe i need to use WinDbg.
usr
I've not been able to confirm this, but it's possible that the version of SOS.dll that you are using does not have this option. There are currently two versions of SOS.dll floating around - for .NET framework 1.1 and 2.0. My guess is that the 1.1 version does have the -l option and maybe the 2.0 version does not. If this is the case, then you might be using 2.0 version, so my suggestion is not viable for you. Gutted :(
Jason Evans
A: 

The best place to start is the -stat argument. This will dump a summary of the live object table as opposed to every object in the system. It will give you a good idea on what objects in particular are causing the most overhead

!dumpheap -stat

I would also recomend taking a look at the following blog articles as they are geared to helping people use WinDbg to track down this sort of problem

JaredPar
Thanks. I already know what object type is causing this because I already did this. I now need to know where those objects are referenced.
usr