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

推荐订阅源

人人都是产品经理
人人都是产品经理
Stack Overflow Blog
Stack Overflow Blog
L
LINUX DO - 最新话题
Google Online Security Blog
Google Online Security Blog
Schneier on Security
Schneier on Security
Spread Privacy
Spread Privacy
www.infosecurity-magazine.com
www.infosecurity-magazine.com
雷峰网
雷峰网
Google DeepMind News
Google DeepMind News
Microsoft Azure Blog
Microsoft Azure Blog
IT之家
IT之家
V
Vulnerabilities – Threatpost
K
Kaspersky official blog
S
Schneier on Security
B
Blog
The Register - Security
The Register - Security
SecWiki News
SecWiki News
Hacker News: Ask HN
Hacker News: Ask HN
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
S
Security Affairs
T
The Blog of Author Tim Ferriss
G
Google Developers Blog
T
Tenable Blog
P
Proofpoint News Feed
Apple Machine Learning Research
Apple Machine Learning Research
D
DataBreaches.Net
S
Secure Thoughts
Security Latest
Security Latest
H
Heimdal Security Blog
The Hacker News
The Hacker News
O
OpenAI News
AWS News Blog
AWS News Blog
量子位
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
腾讯CDC
U
Unit 42
L
Lohrmann on Cybersecurity
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
L
LangChain Blog
阮一峰的网络日志
阮一峰的网络日志
T
The Exploit Database - CXSecurity.com
NISL@THU
NISL@THU
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Hugging Face - Blog
Hugging Face - Blog
The Last Watchdog
The Last Watchdog
Recorded Future
Recorded Future
V2EX - 技术
V2EX - 技术
爱范儿
爱范儿
F
Full Disclosure

博客园 - 鞠强

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