WinDbg and XmlText objects

T

thejeffross

I have a memory problem that keeps causing server resets, so I'm using
WinDbg to figure out what the problem is.

When I look at the heap, WinDbg tells me that there are over one
million XmlText objects, each taking up 20 bytes.

If I do a memory view of one of them, I get this:

10017c58 7c bb 08 16 fc 7b 01 10 58 7c 01 10 84 7b 01 10 00 00 00 00

How do I get the Value property from this?

Thanks,

Jeff Ross
 
S

Scott Allen

Hi Jeff:

Here is how I would get to the value:


0:021> .load E:\Program Files\Debugging Tools for Windows\clr10\sos
0:021> !EEVersion
Loaded Son of Strike data table version 5 from
"E:\WIN2003\Microsoft.NET\Framework\v1.1.4322\mscorwks.dll"
1.1.4322.2300 retail
Workstation build

// So far I've just loaded the SOS extension DLL.

0:021> !name2ee System.Xml.dll System.Xml.XmlText
--------------------------------------
MethodTable: 01e7bf84
EEClass: 01e66894
Name: System.Xml.XmlText

// This gives me the MethodTable for XmlText, I can use the
// MT to scan the heap for all instances of XmlText:

0:021> !dumpheap -mt 01e7bf84
Address MT Size Gen
0256e524 01e7bf84 20 2 System.Xml.XmlText
0256e59c 01e7bf84 20 2 System.Xml.XmlText
total 2 objects
Statistics:
MT Count TotalSize Class Name
1e7bf84 2 40 System.Xml.XmlText
Total 2 objects

// The formatting on this post might not be the best, but you can
// see above I have two XmlText objects on the heap, so let's
// take a look at the first one:

0:021> !dumpobj 0256e524
Name: System.Xml.XmlText
MethodTable 0x01e7bf84
EEClass 0x01e66894
Size 20(0x14) bytes
mdToken: 0200008a (Unknown Module)
FieldDesc*: 00000000
MT Field Offset Type Attr Value
Name
01e7631c 4000350 4 CLASS instance 0256e3fc
parentNode
01e7752c 4000372 8 CLASS instance 0256e538
next
01e7ab94 4000373 c CLASS instance 02166ba8
data

// First thing to notice is that all XmlText objects have a
// size of 20 bytes because they include three object references
// in thier instance data.
//
// The third field (data) is the one you want to look at, so let's
// DumpObject again:

0:021> !dumpobj 02166ba8
Name: System.String
MethodTable 0x79b94638
EEClass 0x79b94984
Size 92(0x5c) bytes
mdToken: 0200000f (Unknown Module)
String: This is the text of the root element
FieldDesc*: 79b949e8
.....

// So the first XmlText object contained a reference to a string, the
// string takes up 92 bytes on the heap and the text of the string is
// "This is the text of the root element".


You might also want to check out CLRProfiler before getting into this
level of detail....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top