[Reprinted] Memory leakage

Source: Internet
Author: User

Memory leakage typeHttp://www.red-gate.com/supportcenter/Content/ANTS_Memory_Profiler/help/7.2/amp_memory_leaks)

Most memory problems come down to one of the following types. Determining the type of the problem will help you locate and solve the problem.

Managed Memory leakage

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.

Unmanaged memory leakage

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. net heap.

Fragments of a large object Stack

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

Large-capacity RAM usage

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 handle 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.

 

Memory counters:

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 supported des memory in use

Yes

No

Virtual bytes

Only supported des memory in use

Yes

Yes

Private Working Set

(Unavailable in ants memory Profiler)

Only supported des memory in use

No

No

Performance Monitor ( perfmon.exe ) has a performance counter called # bytes in all heaps , which is part of. 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 memory des memory allocated to the. NET heaps but which is not being used, whilst the ants memory profiler # Bytes in all heaps Only supported des memory that is both allocated and in use.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.