【转载】内存泄露

内存泄露的类型http://www.red-gate.com/supportcenter/Content/ANTS_Memory_Profiler/help/7.2/amp_memory_leaks

大多数内存问题都会归结为以下类型之一。确定问题的类型将有助于你定位和解决问题。 

托管内存泄露

The typical symptom of a memory leak is that the performance degrades while the program runs; performance recovers on restart and then degrades again. The amount of bytes in the .NET heap increases.

非托管内存泄露

The performance degrades while the program runs; this recovers on restart and then degrades again. The number of private bytes (the amount of real and paged memory requested by the program) in use often increases at a greater rate than the number of bytes in the .NET heap.

大对象堆的碎片

The main symptom of fragmentation is that OutOfMemory exceptions are thrown even though there is sufficient space on the .NET heap.

大容量的RAM占用

Some programs need to use a lot of memory. There is little specific advice that can be given about this, since the best approach to reducing the amount of memory used will depend on your program's requirements. Using a profiler may give you suggestions for where to optimize code by showing which parts of your program are using the most memory.

 

内存计数器的含义:

By default, ANTS Memory Profiler uses the Private bytes counter, because this measure is considered the most useful for most kinds of memory problem. 

Windows Task Manager shows the Private working set counter by default. The Private working set is unavailable in ANTS Memory Profiler because it is only accurate immediately after a garbage collection.

The following table summarizes some of the main different ways of measuring memory:

 

Counter

Description

Including shared processes?
(DLLs in memory, .NET runtime)

Including memory paged to disk?

Private bytes

Includes memory allocated (even if not in use)

No

Yes

Working set

Only includes memory in use

Yes

No

Virtual bytes

Only includes memory in use

Yes

Yes

Private working set
(Unavailable in ANTS Memory Profiler)

Only includes memory in use

No

No

Performance Monitor (perfmon.exe) has a performance counter called # Bytes in all heaps, which is part of the .NET CLR Memory object.

The value of the Performance Monitor # Bytes in all heaps counter is often larger than the ANTS Memory Profiler # Bytes in all heaps counter. The discrepancy is caused because the Performance Monitor # Bytes in all heaps counter includes memory allocated to the .NET heaps but which is not being used, whilst the ANTS Memory Profiler # Bytes in all heaps only includes memory that is both allocated and in use.

 

转载于:https://www.cnblogs.com/gaozhongfa/archive/2011/12/26/2302476.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值