可DebugDiag资料生成具有&QUOT报告,包括大小和QUOT;如Visual Studio 2013 [英] Can DebugDiag generate reports with "inclusive size" like Visual Studio 2013
问题描述
的Visual Studio 2013可以显示为包容性的大小列(其中包括子对象的大小) - <一href="http://blogs.msdn.com/b/visualstudioalm/archive/2013/10/16/net-memory-analysis-enhancements-in-visual-studio-2013.aspx" rel="nofollow">http://blogs.msdn.com/b/visualstudioalm/archive/2013/10/16/net-memory-analysis-enhancements-in-visual-studio-2013.aspx
Visual Studio 2013 can show a column for inclusive size (which includes size of child objects) - http://blogs.msdn.com/b/visualstudioalm/archive/2013/10/16/net-memory-analysis-enhancements-in-visual-studio-2013.aspx
DebugDiag资料的内存分析报告,目前只显示物体的大小,而不包括子对象。有没有一种方法,使DebugDiag资料包括子对象的大小在其报告?
DebugDiag's memory analysis reports currently only shows object size without including child objects. Is there a way to make DebugDiag include size of child objects in its report?
你有什么建议是一个很好的方式来产生这样一个报告,.NET 4.0,因为Visual Studio中只支持分析.NET 4.5崩溃转储
What do you suggest is a good way to generate such a report for .NET 4.0 since Visual Studio only supports analyzing .NET 4.5 crash dumps
推荐答案
DebugDiag资料2已经完全被改写,现在是一组可执行文件(EXE和DLL)。它不再是一组脚本,你可以很容易地修改,以包括要在那里更多的信息。
DebugDiag
DebugDiag 2 has totally been rewritten and is now a set of executables (EXE and DLL). It is no longer a set of scripts which you could easily modify to include additional information that you want to be there.
你在WinDbg中+ SOS的看到DebugDiag资料的输出simiar到dumpheap -stat
输出:
The output of DebugDiag is simiar to what you see in WinDbg+SOS's !dumpheap -stat
output:
...
575a4518 11547 560508 System.Object[]
575d37b8 91 892344 System.Byte[]
575d2ee4 3488 927512 System.Int32[]
575d0d48 72920 6939284 System.String
Total 120639 objects
其他方法
SOS DO&LT;!地址&gt;
只给没有孩子的大小,但有SOS objsize&LT;!地址&gt;
,这似乎包括儿童(不能交叉检查与Visual Studio 2013年,只有2012):
Other approaches
SOS !do <address>
gives only the size without children, but there is SOS !objsize <address>
, which seems to include children (can't cross check with Visual Studio 2013, only have 2012):
0:008> !do 0b938584
Name: SomeClass
MethodTable: 08947c0c
EEClass: 08956c38
Size: 292(0x124) bytes
...
0:008> !objsize 0b938584
sizeof(0b938584) = 11728 ( 0x2dd0) bytes (SomeClass)
!
要做到这一点对在堆中的所有对象,你可以执行 objsize
在一个循环的每个对象:
To do that for all objects on the heap, you can execute !objsize
for each object in a loop:
.foreach (address {!dumpheap -short}) {!objsize ${address}}
我知道的唯一命令列出的属性值递归是SOSEX的 MDT&LT;!地址&gt; -r
,但它不会输出的大小。
The only command I know that lists property values recursively is SOSEX's !mdt <address> -r
, but it will not output the size.
起点 Pykd 脚本:
0:000> .loadby sos clr; .loadby sos mscorwks
0:000> .load <full path>\sosex.dll
0:000> .load <full path>\pykd.pyd
0:000> !pycmd
>>> gch = dbgCommand("!gch")
>>> lines = gch.split('\n')
>>> for line in lines: dprint(dbgCommand("!objsize "+line[34:50]))
...
preSS输入后 ...
出现。需要注意的是 [34:50]
这可能需要将适配器32位。
Press Enter after ...
appears. Note that [34:50]
this might need to be adapter for 32 bit.
这篇关于可DebugDiag资料生成具有&QUOT报告,包括大小和QUOT;如Visual Studio 2013的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!