처럼 모든 .NET 문제에 대한, 먼저 당신이 할 수있는, 포괄적 크기를 얻으려면
!dumpheap -stat; * Statistics output, good if you don't know what you're looking for
!dumpheap -type <SubstringOfClass>; * If you know what type you're after
!dumpheap -mt <MethodTable>; * If the class substring is not unique enough
를 사용하여 당신은 다음 개체의 목록을 얻을 수 있습니다
.loadby sos clr; .loadby sos mscorwks
SOS 확장이 필요합니다
를 사용하여 개체의 뿌리를 찾으려면
!objsize <address>
를 사용 0
!gcroot <address>
IMHO에는 모든 루트 개체를 표시하는 편리한 방법이 없습니다.
Visual Studio에서 개체를 스택에 나열하는지 잘 모르겠습니다.
0:005> !dumpheap -stat
Statistics:
MT Count TotalSize Class Name
000007fef2611ec8 1 24 System.Collections.Generic.ObjectEqualityComparer`1[[System.Runtime.Serialization.MemberHolder, mscorlib]]
...
000007fef2622968 1 64 System.BaseConfigHandler+CreateAttributeCallback
...
000007fef25fa690 396 117910 System.Byte[]
000007fef25a4458 1570 227560 System.Object[]
000007fef25f6508 3300 234762 System.String
Total 17883 objects
0:005> !dumpheap -stat -type Handler
Statistics:
MT Count TotalSize Class Name
000007fef2622968 1 64 System.BaseConfigHandler+CreateAttributeCallback
000007fef26228b0 1 64 System.BaseConfigHandler+CreateNodeCallback
000007fef26227f8 1 64 System.BaseConfigHandler+ErrorCallback
Total 3 objects
0:005> !dumpheap -mt 000007fef2622968
Address MT Size
0000000002594848 000007fef2622968 64
Statistics:
MT Count TotalSize Class Name
000007fef2622968 1 64 System.BaseConfigHandler+CreateAttributeCallback
Total 1 objects
0:005> !objsize 0000000002594848
sizeof(0000000002594848) = 168728 (0x29318) bytes (System.BaseConfigHandler+CreateAttributeCallback)
0:005> !gcroot 0000000002594848
Found 0 unique roots (run '!GCRoot -all' to see all roots).
0:005> !gcroot -all 0000000002594848
Found 0 roots.
는 그래서이 객체의 참조가없는 쓰레기가 다음 GC에서 수집 될 것으로 보인다 WinDbg는 이것은
~*e !dso
예 연습이 될 것입니다.
0:001> !dso
OS Thread Id: 0xb2c (1)
RSP/REG Object Name
00000000024B0000 00000000024b1048 System.Exception
관련 : http://stackoverflow.com/questions/25247149/can-debugdiag-generate-reports-with-inclusive-size-like-visual-studio-2013/25915022#25915022 –