• Answers
  • Web
Answer 1 out of 3
 
207 helpful answers

They're coming to take me away, Ha-haaa!

Advanced .NET Debugging Blog

My personal blog

A:

Unfortunately I'm unaware of a new version of SOS for .NET 2.0 and the SOS supplied with WinDbg is for .NET 1.1 only.

It seems the -gen parameter of the !dumpheap command was left out when they shipped .NET 2.0.

You can, however, get the same functionality in a different way.

By combining two commands - !eeheap and !dumpheap you can get the same functionality as the -gen parameter in !dumpheap.

!dumpheap can also get a start and end address in which to search. If we can supply it with the memory segments of a specific generation you will get the same functionality. The annoying thing is that if they have more than one segment and they are not following each other you will have to run it for each segment.

First, run "!eeheap -gc". This will list all of the generation's start addresses as well as memory segments that they use. The output will look something like this:

0:014> !eeheap -gc
Number of GC Heaps: 1
generation 0 starts at 0x013f694c
generation 1 starts at 0x013cb21c
generation 2 starts at 0x01391000
ephemeral segment allocation context: (0x01406de8, 0x01408970)
 segment    begin allocated     size
001b2da0 7a721784  7a74248c 0x00020d08(134408)
00197dc8 7b451688  7b467f9c 0x00016914(92436)
001847b0 790d6358  790f5800 0x0001f4a8(128168)
01390000 01391000  01408970 0x00077970(489840)
Large object heap starts at 0x02391000
 segment    begin allocated     size
02390000 02391000  0239a130 0x00009130(37168)
Total Size   0xd7564(882020)
------------------------------
GC Heap Size   0xd7564(882020)

The bold number, for example, shows that generation 2 start at the address of 01391000. At the list of segments below we can see that we have a segment who's address starts at 01391000 and ends at 01408970.

Now we can run the command "!dumpheap 01391000 01408970" and see all the objects in this segments which are, in fact, all generation 2 objects (at least in this sample application).

I do hope that Microsoft will release an updated version of the SOS for .NET 2.0 which will include all of the missing functionality that we had in previous versions of SOS for .NET 1.1 (and hopefully with some new and interesting features as well Smile)

Posted 3 years ago
Eran was invited by Yedda to answer this question.

Helpful?(2)
Rated as Best Answer
 
Comment About This Answer (or add your own answer)

Feed - Subscribe to changes to this Q&A Blog
ADVERTISEMENT
  • Answers
  • Web
Copyright © 2006-2009, Yedda Inc. and respective copyright owners