惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

大猫的无限游戏
大猫的无限游戏
Webroot Blog
Webroot Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
T
Threat Research - Cisco Blogs
V2EX - 技术
V2EX - 技术
L
LINUX DO - 热门话题
Google DeepMind News
Google DeepMind News
Recorded Future
Recorded Future
S
Schneier on Security
I
InfoQ
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
The GitHub Blog
The GitHub Blog
S
Security @ Cisco Blogs
O
OpenAI News
W
WeLiveSecurity
Vercel News
Vercel News
阮一峰的网络日志
阮一峰的网络日志
Simon Willison's Weblog
Simon Willison's Weblog
人人都是产品经理
人人都是产品经理
Cloudbric
Cloudbric
The Last Watchdog
The Last Watchdog
The Hacker News
The Hacker News
Google Online Security Blog
Google Online Security Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
GbyAI
GbyAI
NISL@THU
NISL@THU
T
Tailwind CSS Blog
V
Visual Studio Blog
PCI Perspectives
PCI Perspectives
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Jina AI
Jina AI
D
DataBreaches.Net
B
Blog RSS Feed
N
News and Events Feed by Topic
N
News and Events Feed by Topic
H
Heimdal Security Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
腾讯CDC
Latest news
Latest news
V
Vulnerabilities – Threatpost
Hacker News: Ask HN
Hacker News: Ask HN
WordPress大学
WordPress大学
V
V2EX
aimingoo的专栏
aimingoo的专栏
博客园 - 司徒正美
Apple Machine Learning Research
Apple Machine Learning Research
D
Darknet – Hacking Tools, Hacker News & Cyber Security
The Register - Security
The Register - Security
Help Net Security
Help Net Security

博客园 - 鞠强

HBase初探 C#访问Azure的资源 HDInsight - 1,简介 Windows8.1画热度图 - 坑 使用windbg查看DependencyObject的属性 LiveSDK初始化/登录时失败的解决办法 开发WP版本的大菠萝英雄榜 SQL 2014 in-memory中的storage部分 XAML绑定 Kinect 1 Diablo3狗熊榜 微软上海招聘有经验的.NET开发人员 塔防蜀的存档分析 我的HD2手机 和我一起作Tess的windbg lab,结束 和我一起作Tess的windbg lab - Lab6, MemoryLeak 和我一起作Tess的windbg lab - Lab5, Crash 和我一起作Tess的windbg lab - Lab4, High CPU 和我一起作Tess的windbg lab - Lab3, Memory
和我一起作Tess的windbg lab - Lab7, MemoryLeak
鞠强 · 2010-06-27 · via 博客园 - 鞠强

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

操作步骤:

1、产生压力:tinyget -srv:localhost -uri:/BuggyBits/News.aspx -threads:500 -loop:200

2、抓一个hang的dump,看看gc heap大小,!eeheap -gc,如下:

  GC Heap Size  0x1899f44c(412742732),大概400M,dump文件整个为550M。

3、看一下gc heap的总体状况:!dumpheap -stat,输出如下:

  7912d7c0     1342    400044140 System.Int32[]

  嗯,一共1300多个数组,但是这些数组居然占了400M,和gc heap的大小差不多。

4、察看一下详细情况,因为只有1300多个,所以我们可以全部打印出来:!dumpheap -mt 7912d7c0

5、几乎所有的数组,大小都是400K,随便找一个,然后找一下该数组的root,运行!gcroot 1f981e60,结果如下:

Scan Thread 49 OSTHread 2234
DOMAIN(00115B40):HANDLE(WeakLn):24b10dc:Root:02a621f4(System.Web.NativeFileChangeNotification)->
02a621d8(System.Web.DirMonCompletion)->
02a61ea4(System.Web.DirectoryMonitor)->
02a61ec8(System.Collections.Hashtable)->
02a61f00(System.Collections.Hashtable+bucket[])->
02a62100(System.Web.FileMonitor)->
02a62134(System.Collections.Specialized.HybridDictionary)->
02a62178(System.Collections.Specialized.ListDictionary)->
02a62194(System.Collections.Specialized.ListDictionary+DictionaryNode)->
02a5d538(System.Web.Compilation.BuildManager)->
02a5e0fc(System.Web.Compilation.MemoryBuildResultCache)->
02a2c970(System.Web.Caching.CacheSingle)->
02a2ca00(System.Web.Caching.CacheExpires)->
02a2ca20(System.Object[])->
02a2cd64(System.Web.Caching.ExpiresBucket)->
02b2e948(System.Web.Caching.ExpiresPage[])->
1b078ff0(System.Web.Caching.ExpiresEntry[])->
1b20583c(System.Web.Caching.CacheEntry)->
1b20581c(System.Web.Caching.CacheItemRemovedCallback)->
1b203db0(ASP.news_aspx)->
1f981e60(System.Int32[])
6、看其他的几个数组,引用顺序差不多。

7、猜测:代码中用了cache,cache中包含了一个400K的数组。但是由于某种原因,cache里面的东西没释放掉,越来越大。

8、查看源代码

    protected void Page_Load(object sender, EventArgs e)
    {
        string news = "<I>New site launched 2008-02-02</I>";
        string key = Guid.NewGuid().ToString();
        Cache.Add(key, news, null, Cache.NoAbsoluteExpiration, new TimeSpan(0, 5, 0), CacheItemPriority.NotRemovable, new CacheItemRemovedCallback(this.RemovedCallback));
        lblNews.Text = ((string)Cache[key]);
    }

  Cache有一个5分钟的失效期。但是由于我们的测试中,负载上来了,还没有到5分钟,所以看到的cache还在内存中。那么5分钟之后呢,可能会消失。但是更可能的是,在3分钟的时候,负载太大了,cache的东西又加上来了,最终导致OOM,程序挂了。

Over