运维开发网

dump net core windbg 内存分析

运维开发网 https://www.qedev.com 2020-07-23 11:26 出处:网络
 !dumpheap -stat //检查当前所有托管类型的统计信息 0:000> !dumpheap -stat //检查当前所有托管类型的统计信息

 !dumpheap -stat //检查当前所有托管类型的统计信息

0:000> !dumpheap -stat //检查当前所有托管类型的统计信息
....
00007ffdb9387a98   777101     69462436 System.Char[]
00007ffdb938c988   588917    115563505 System.Byte[]
00007ffdb9389220  1026406    119828936 System.Int32[]
00007ffdb93516a8   663559    128819040 System.Collections.Generic.Dictionary`2+Entry[[System.String, mscorlib],[System.Object, mscorlib]][]
00000218c6c30a80  6436865    197832116      Free
00007ffdae9cc240    23171    273333144 System.Collections.Generic.HashSet`1+Slot[[System.String, mscorlib]][]
00007ffdb9391f28 13885170    333244080 System.Boolean
00007ffd5c24a068 14003455    560138200 Kingdee.BOS.JSON.JSONArray
00007ffdb9386fc0 14373648   1393615400 System.Object[]
00007ffdb9386948 76146065   4000287202 System.String
Total 138435970 objects

  

!dumpheap -mt 00007ffdb9386948 -min 200 //查看mt内容

0:000> !dumpheap -mt 00007ffdb9386948 -min 200 //查看200byte以上的string
Address               MT     Size
...
0000021bcbaf5158 00007ffdb9386948     1140
0000021d375d1038 00007ffdb9386948   149698     
0000021d375f5920 00007ffdb9386948   149698     
0000021d3765b138 00007ffdb9386948   149706     
0000021d37f739c8 00007ffdb9386948   217120     
0000021d37fa8a08 00007ffdb9386948   190162     
0000021d38047330 00007ffdb9386948  1224698     
0000021d3829d348 00007ffdb9386948  1224698     
0000021d386bd678 00007ffdb9386948  2610994     
0000021d38bb8500 00007ffdb9386948  2610994     


Statistics:
              MT    Count    TotalSize Class Name
00007ffdb9386948    10991     76632628 System.String
Total 10991 objects

  

使用!do命令查看一个对象的内容

0.000> !do 0000021bcbaf5158 //使用!do命令查看一个对象的内容
Name:        System.String
MethodTable: 00007ffdb9386948
EEClass:     00007ffdb8c850e0
Size:        1140(0x474) bytes
File:        C:\Windows\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll
String:      5b13710029d012False2052_T_BD_MATERIAL_MATERIAL.FAuxPropertyIdFBaseUnitIdFCategoryIDFChargeIDFCheckIncomingFDefaultVendorFErpClsIDFInvPtyIdFIsAffectPlanFIsAffectPlan1FIsBatchManageFIsComControlFIsEnableFIsEnable1FIsExpParToFlotFIsInventoryFIsPRFIsReturnMaterialFIsSourceControlFIsVmiBusinessFNameFNumberFPlanModeFPurchasePriceUnitIdFPurchaseUnitIdFPurPriceURNomFPurPriceURNumFPurURNomFPurURNumFReceiveAdvanceDaysFReceiveDelayDaysFReceiveMaxScaleFReceiveMinScaleFSalePriceUnitIdFSaleUnitIdFSpecificationFStockIdFStockPlaceIdFStoreUnitIDFTaxTypeFUseOrgId111193
Fields:
              MT    Field   Offset                 Type VT     Attr            Value Name
00007ffdb9389288  400026f        8         System.Int32  1 instance              557 m_stringLength
00007ffdb9387b00  4000270        c          System.Char  1 instance               35 m_firstChar
00007ffdb9386948  4000274       90        System.String  0   shared           static Empty
                                 >> Domain:Value  00000218c6c4d220:NotInit  0000021d52d81840:NotInit  <<

  

使用!gcroot 查看一个对象的gc根

0:000> !gcroot 0000021bcbaf5158 //使用!gcroot 查看一个对象的gc根
HandleTable:
    00000218c6ff15e8 (pinned handle)
    -> 0000021cc75ebe68 System.Object[]
    -> 0000021bc7629a10 Kingdee.BOS.Cache.KCacheManagerFactory
    -> 0000021bc7629ab8 System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[Kingdee.BOS.Cache.AbstractKCacheManager, Kingdee.BOS]]
    -> 0000021c4da6fa48 System.Collections.Generic.Dictionary`2+Entry[[System.String, mscorlib],[Kingdee.BOS.Cache.AbstractKCacheManager, Kingdee.BOS]][]
    -> 00000218c83861b8 Kingdee.BOS.Cache.KCacheManager
    -> 00000218c8386630 Kingdee.BOS.Cache.ECache.ECacheManager
    -> 00000218c83866e8 System.Collections.Concurrent.ConcurrentDictionary`2[[System.String, mscorlib],[System.Collections.Generic.HashSet`1[[System.String, mscorlib]], System.Core]]
    -> 0000021bcbae0c70 System.Collections.Concurrent.ConcurrentDictionary`2+Tables[[System.String, mscorlib],[System.Collections.Generic.HashSet`1[[System.String, mscorlib]], System.Core]]
    -> 0000021bcbad0128 System.Collections.Concurrent.ConcurrentDictionary`2+Node[[System.String, mscorlib],[System.Collections.Generic.HashSet`1[[System.String, mscorlib]], System.Core]][]
    -> 0000021bcbb34bf8 System.Collections.Concurrent.ConcurrentDictionary`2+Node[[System.String, mscorlib],[System.Collections.Generic.HashSet`1[[System.String, mscorlib]], System.Core]]
    -> 0000021bcbada790 System.Collections.Concurrent.ConcurrentDictionary`2+Node[[System.String, mscorlib],[System.Collections.Generic.HashSet`1[[System.String, mscorlib]], System.Core]]
    -> 0000021a49766460 System.Collections.Generic.HashSet`1[[System.String, mscorlib]]
    -> 00000219540976b0 System.Collections.Generic.HashSet`1+Slot[[System.String, mscorlib]][]
    -> 0000021bcbaf5158 System.String

Found 1 unique roots (run ‘!GCRoot -all‘ to see all roots).

  

!DumpObj /d 0000021975972b48 查看一个对象

0:000> !DumpObj /d 0000021975972b48  //查看第一个JSONArray
Name:        System.Object[]
MethodTable: 00007ffdb9386fc0
EEClass:     00007ffdb8d4aa00
Size:        88(0x58) bytes
Array:       Rank 1, Number of elements 8, Type CLASS (Print Array)
Fields:
None

  

!DumpArray /d 0000021975972b48 查看一个数组

0:000> !DumpArray /d 0000021975972b48 
Name:        System.Object[]
MethodTable: 00007ffdb9386fc0
EEClass:     00007ffdb8d4aa00
Size:        88(0x58) bytes
Array:       Rank 1, Number of elements 8, Type CLASS
Element Methodtable: 00007ffdb9386f28
[0] 0000021975972a08
[1] 0000021975972a70
[2] 0000021975972a40
[3] 0000021ac75e87b8
[4] 0000021975972b10
[5] 0000021975972ba0
[6] null
[7] null
0:000> !DumpObj /d 0000021975972a08
Name:        System.String
MethodTable: 00007ffdb9386948
EEClass:     00007ffdb8c850e0
Size:        54(0x36) bytes
File:        C:\Windows\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll
String:      555d8ca25a6261
Fields:7
              MT    Field   Offset                 Type VT     Attr            Value Name
00007ffdb9389288  400026f        8         System.Int32  1 instance               14 m_stringLength
00007ffdb9387b00  4000270        c          System.Char  1 instance               35 m_firstChar
00007ffdb9386948  4000274       90        System.String  0   shared           static Empty
                                 >> Domain:Value  00000218c6c4d220:NotInit  0000021d52d81840:NotInit  <<
0

精彩评论

暂无评论...
验证码 换一张
取 消