Sky Line
Sky Line

Reputation: 47

3GB strings in Gen 2, How to dump limited large objects in Gen 2 only?

by using command !dumpgen 2 -stat, I find that there are 3GB strings, 23,531,124 3,110,704,598 System.String, if I dump all of them, it will hang the windbg, is there any way I can only dump limited large object result in Gen 2 only? thus I can dump those objects and see what they are. SAME ASK for LOH. Thanks for help in advance.

Upvotes: 0

Views: 225

Answers (1)

Brian Rasmussen
Brian Rasmussen

Reputation: 116471

The text is stored inline with the instance of the String. You can use du to dump the Unicode characters from the instance. Here's an example. I have a very long string at address 03ec5528 that I have located using !dumpstat. Dumping this I get: (I have cut most of the string from the output) and you don't need to dump the object - it's just to illustrate what I'm using for the example.

0:000> !DumpObj 03ec5528
Name:        System.String
MethodTable: 7235d6d8
EEClass:     71f34a50
Size:        135808(0x21280) bytes
File:        C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll
String:      Lorem ipsum dolor sit amet, consectetur adipiscing elit. (I HAVE CUT MOST OF THE STRING FROM THE OUTPUT) 
Fields:
      MT    Field   Offset                 Type VT     Attr    Value Name
7235f52c  4000275        4         System.Int32  1 instance    67897 m_stringLength
7235e120  4000276        8          System.Char  1 instance       4c m_firstChar
7235d6d8  400027a       54        System.String  0   shared   static Empty
    >> Domain:Value  00f25e58:NotInit  <<

To list the text use du with the base address plus the offset (+8 on 32 bit). Using the default output for du produces the text below. You can control the length output by providing a range for the command.

0:000> du 03ec5528+8
03ec5530  "Lorem ipsum dolor sit amet, cons"
03ec5570  "ectetur adipiscing elit. Integer"
03ec55b0  " in dapibus urna, sed lobortis o"
03ec55f0  "rci. Integer sapien nunc, rutrum"
03ec5630  " id libero sollicitudin, interdu"
03ec5670  "m ornare velit. Aenean porttitor"
03ec56b0  " convallis vulputate. Nunc at au"
03ec56f0  "gue a nibh finibus commodo. Morb"
03ec5730  "i volutpat eleifend nunc vel mat"
03ec5770  "tis. Mauris accumsan, est ac fri"
03ec57b0  "ngilla interdum, purus mi euismo"
03ec57f0  "d purus, ac dapibus massa dolor "

I hope that helps.

Upvotes: 0

Related Questions