和我一起作Tess的windbg lab - Lab6, MemoryLeak

原文地址:http://blogs.msdn.com/b/tess/archive/2008/03/17/net-debugging-demos-lab-6-memory-leak.aspx

操作步骤:

1、产生压力: tinyget -srv:localhost -uri:/BuggyBits/ProductInfo.aspx?ProductName=Bugspray -threads:50 -loop:20

2、这个比较有意思,CPU很高,经常100%,内存很少,几十M而已。如果你仔细看taskmgr,会看到有几个csc诡异的出现,忙了一会,又消失了。

3、抓一个hang的dump,运行!eeheap -gc,看看内存状况:

  GC Heap Size  0x68a0fc(6856956)

  托管内存只用到了6M多,而我的dump是190M,那么,其余的内存被谁用了?

4、联想到步骤2中的诡异的csc进程,我们需要再检查一下,!eeheap -loader,看看有多少dll在loader heap里面?我这里一共看到了2223个

5、随便找一个module看看

  0:000> !dumpmodule -mt 06f0ab78
  Name: oghe0kiv, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
  Attributes: PEFile
  Assembly: 07093808
  LoaderHeap: 00000000
  TypeDefToMethodTableMap: 0702f8c4
  TypeRefToMethodTableMap: 0702f8dc
  MethodDefToDescMap: 0702f93c
  FieldDefToDescMap: 0702f9a8
  MemberRefToDescMap: 0702f9d4
  FileReferencesMap: 0702fac4
  AssemblyReferencesMap: 0702fac8
  MetaData start address: 072e09e4 (4184 bytes)

  Types defined in this module

      MT    TypeDef Name
------------------------------------------------------------------------------
  06f0b7ac 0x02000002 Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterProduct
  06f0b6fc 0x02000006 Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializerContract

  Types referenced in this module

      MT    TypeRef Name
------------------------------------------------------------------------------
  63a28fb0 0x01000001 System.Xml.Serialization.XmlSerializationWriter
  63a295a4 0x01000004 System.Xml.Serialization.XmlSerializerImplementation
  05e60b3c 0x01000005 Product
  05e60bbc 0x01000006 ShippingInfo
  79101fe4 0x01000008 System.Collections.Hashtable
  79106894 0x01000009 System.Type
  790fd0f0 0x0100000f System.Object
  639ff1c4 0x01000013 System.Xml.XmlConvert

6、看到这里基本清楚了,这就是那个著名的XmlSerializer的问题。可以参考我以前写的blog:http://www.cnblogs.com/juqiang/archive/2008/01/15/1039936.html

 

Over

posted @ 2010-06-27 14:59  鞠强  阅读(996)  评论(1编辑  收藏  举报

hello

world