通过性能计数器确定.net应用程序是否存在内存溢出

转载自:https://mitch-wheat.blogspot.jp/2010/11/determine-if-your-net-application-has.html

Run Perfmon.exe and add these counters:

  • Process / Private bytes
  • .NET CLR Memory / # bytes in all heaps
  • .NET CLR LocksAndThreads / # of current logical threads

Run your application for a representative length of time and exercise its functionality.

1.第一种情况(非托管内存溢出):

  If Private bytes is increasing but # bytes in all heaps is not, then unmanaged memory is leaking.

2.第二种情况(托管内存溢出):

  If both both are increasing, then managed memory is leaking. 

3.第三种情况(线程栈溢出):

  If the # of current logical threads is increasing beyond what you expect, then thread stacks are leaking.

4.第四种情况(线程栈溢出):

  If Private Bytes is periodically jumping in 1MB increments with a corresponding increase in # of current logical Threads, a thread stack leak is the likely cause.

posted @ 2017-03-16 11:54  静若清池  阅读(256)  评论(0编辑  收藏  举报