态度决定高度、企图决定版图、格局决定结局

导航

dump

Dump:

资源:

http://blogs.msdn.com/johan/archive/2007/11/26/getting-started-with-windbg-part-i.aspx

http://blogs.msdn.com/johan/archive/2007/11/26/getting-started-with-windbg-part-ii.aspx

 

 

More Command:

.load

!help

!sos .help

!threadpool

!threads

!clrstack

!dumpobject(!do)

!dumparray(!da)

!dumpstackobjet(!dso)

!dumpheap

 

一个具体运用说明:

当前系统出现内存增长严重,暂时猜测是由于缓存被过分使用造成。开始分析:

1.        找出有那些数据在缓存中

!dumpheap –type System.Web.Caching.Cache –stat

total 3064 objects

Statistics:

      MT    Count    TotalSize Class Name

6639de3c        1           12 System.Web.Caching.CacheKeyComparer

6639dc9c        1           24 System.Web.Caching.CacheMultiple

6639d878        2           24 System.Web.Caching.Cache

6639d978        1           32 System.Web.Caching.CacheMemoryStats

6639dafc        1           36 System.Web.Caching.CacheMemoryTotalMemoryPressure

6639e100        2           40 System.Web.Caching.CacheUsage

6639d7a4        1           52 System.Web.Caching.CacheCommon

6639dbbc        1           60 System.Web.Caching.CacheMemoryPrivateBytesPressure

6639df10        2           64 System.Web.Caching.CacheExpires

6639ed0c        5           80 System.Web.Caching.CacheDependency+DepFileInfo

6639dd2c        2          152 System.Web.Caching.CacheSingle

6639ebb8        9          324 System.Web.Caching.CacheDependency

6639e3fc     1019        20380 System.Web.Caching.CacheKey

6639d6b8     1005        32160 System.Web.Caching.CacheItemRemovedCallback

6639e4c0     1012        72864 System.Web.Caching.CacheEntry

Total 3064 objects

 

2.

继续查看6639d878

0:014> !dumpheap -mt 6639d878

 Address       MT     Size

01574004 6639d878       12    

015f7cd8 6639d878       12    

total 2 objects

Statistics:

      MT    Count    TotalSize Class Name

6639d878        2           24 System.Web.Caching.Cache

Total 2 objects

 

2.        查看Cache内对象大小:

0:014> !objsize 6639d878

6639d878 is not a valid object.

0:014> !objsize 01574004

sizeof(01574004) =       702840 (     0xab978) bytes (System.Web.Caching.Cache)

 

3.        缓存中到底存什么了?

缓存的东西在System.Web.Caching.CacheEntry中。

0:014> !dumpheap -mt 6639e4c0    

 Address       MT     Size

0157685c 6639e4c0       72    

01583b4c 6639e4c0       72    

0158ddd4 6639e4c0       72    

0158f02c 6639e4c0       72    

015cba10 6639e4c0       72    

015d0ea4 6639e4c0       72    

015fe940 6639e4c0       72    

01602c60 6639e4c0       72    

0161f84c 6639e4c0       72    

016f2f60 6639e4c0       72    

016f3270 6639e4c0       72    

01720ca8 6639e4c0       72    

01721ecc 6639e4c0       72    

017225fc 6639e4c0       72    

017227bc 6639e4c0       72    

0172285c 6639e4c0       72    

017228fc 6639e4c0       72    

01722abc 6639e4c0       72    

01722b5c 6639e4c0       72    

01722bfc 6639e4c0       72    

total 1012 objects

Statistics:

      MT    Count    TotalSize Class Name

6639e4c0     1012        72864 System.Web.Caching.CacheEntry

 

那么每个CacheEntry中存的是什么呢?

使用命令!dumpobject

!do 01722bfc

0:014> !do 01722bfc

Name: System.Web.Caching.CacheEntry

MethodTable: 6639e4c0

EEClass: 6639e448

Size: 72(0x48) bytes

 (C:\Windows\assembly\GAC_32\System.Web\2.0.0.0__b03f5f7f11d50a3a\System.Web.dll)

Fields:

      MT    Field   Offset                 Type VT     Attr    Value Name

790fd8c4  40013ef        4        System.String  0 instance 01722ba4 _key

79101e20  40013f0        c          System.Byte  1 instance       34 _bits

79102290  40013f1        8         System.Int32  1 instance -842352759 _hashCode

790fd0f0  40013f8       10        System.Object  0 instance 01722bb8 _value

7910c878  40013f9       1c      System.DateTime  1 instance 01722c18 _utcCreated

7910c878  40013fa       24      System.DateTime  1 instance 01722c20 _utcExpires

7911228c  40013fb       2c      System.TimeSpan  1 instance 01722c28 _slidingExpiration

79101e20  40013fc        d          System.Byte  1 instance        1 _expiresBucket

6639e5fc  40013fd       34 ...g.ExpiresEntryRef  1 instance 01722c30 _expiresEntryRef

79101e20  40013fe        e          System.Byte  1 instance        2 _usageBucket

6639e6d8  40013ff       38 ...ing.UsageEntryRef  1 instance 01722c34 _usageEntryRef

7910c878  4001400       3c      System.DateTime  1 instance 01722c38 _utcLastUpdate

6639ebb8  4001401       14 ...g.CacheDependency  0 instance 00000000 _dependency

790fd0f0  4001402       18        System.Object  0 instance 01722bd0 _onRemovedTargets

7910c878  40013f5      1e0      System.DateTime  1   shared   static NoAbsoluteExpiration

    >> Domain:Value  003c4888:NotInit  042f0e30:015768a4 <<

7911228c  40013f6      1e4      System.TimeSpan  1   shared   static NoSlidingExpiration

    >> Domain:Value  003c4888:NotInit  042f0e30:015768b4 <<

7911228c  40013f7      1e8      System.TimeSpan  1   shared   static OneYear

    >> Domain:Value  003c4888:NotInit  042f0e30:015768c4 <<

posted on 2007-12-23 18:36  flyingchen  阅读(732)  评论(0编辑  收藏  举报