advertisement

Analyzing .Net Application Memory Usage And Issues

40 %
60 %
advertisement
Information about Analyzing .Net Application Memory Usage And Issues

Published on May 8, 2009

Author: gregsohl

Source: slideshare.net

Description

Throughout my development career I've made use of great tools for analyzing memory usage in my applications. The .NET environment is no exception and the available tools are excellent.

This presentation discussed and demonstrated using 2 commercial and 1 free tool for profiling the memory usage of a .NET application or web site.
advertisement

Analyzing .NET Application Memory Usage and Issues Using Free and Commercial Profiling Tools Presented by Greg Sohl © 2006, Gregory M. Sohl

Memory Issues? Huh? .NET has Garbage Collection. I don’t have to worry about memory anymore! Users have lots of memory now. I don’t have to worry about using lots of memory anymore! Windows has virtual memory space. I don’t have to worry about using lots of memory anymore!

.NET has Garbage Collection. I don’t have to worry about memory anymore!

Users have lots of memory now. I don’t have to worry about using lots of memory anymore!

Windows has virtual memory space. I don’t have to worry about using lots of memory anymore!

Common .NET Memory Issues Too much allocation Memory allocations are long lived Managed memory leaks – reference leaks Work “with” the Garbage Collector. It’s your friend - but only if you are nice to it.

Too much allocation

Memory allocations are long lived

Managed memory leaks – reference leaks

Work “with” the Garbage Collector. It’s your friend - but only if you are nice to it.

Why Use a Profiling Tool? To understand how your allocations correspond with the assumptions made by the GC Track unintentional references to instances (leaks) Track references that are being held too long

To understand how your allocations correspond with the assumptions made by the GC

Track unintentional references to instances (leaks)

Track references that are being held too long

3 Allocation Profilers .NET Memory Profiler – SciTech Commercial – best of breed Ants Profiler – Red Gate Commercial – Useful, but light weight feature set CLR Profiler 2.0 – Microsoft Free – Powerful, but challenging to use Others listed in resources

.NET Memory Profiler – SciTech

Commercial – best of breed

Ants Profiler – Red Gate

Commercial – Useful, but light weight feature set

CLR Profiler 2.0 – Microsoft

Free – Powerful, but challenging to use

Others listed in resources

Definitions Root – The base object holding references to other objects Examples: A static field, a local variable or a method parameter. Root Path - The path of referees from the selected instance to a root Garbage Collection – The process by which objects with no root (unreachable objects) are cleaned up from the heap.

Root – The base object holding references to other objects

Examples: A static field, a local variable or a method parameter.

Root Path - The path of referees from the selected instance to a root

Garbage Collection – The process by which objects with no root (unreachable objects) are cleaned up from the heap.

Sample - Conway’s Game of Life A simulation of cellular automation. http://en.wikipedia.org/wiki/Conway's_Game_of_Life Pulsar Pattern

A simulation of cellular automation.

http://en.wikipedia.org/wiki/Conway's_Game_of_Life

Demo - .NET Memory Profiler Cream of the crop profilers Can attach to running processes Show native memory usage Great real-time view Copy grids to clipboard Low impact mode

Cream of the crop profilers

Can attach to running processes

Show native memory usage

Great real-time view

Copy grids to clipboard

Low impact mode

Demo - CLR Profiler 2.0 For the MacGyver in you. A robust tool, without all the modern conveniences.

For the MacGyver in you.

A robust tool, without all the modern conveniences.

Demo - Ants Profiler Good tool with basic features Memory analysis a recent addition to execution analysis No real-time or IDisposble analysis Best thread support

Good tool with basic features

Memory analysis a recent addition to execution analysis

No real-time or IDisposble analysis

Best thread support

Resources .NET Memory Profiler http://memprofiler.com/ Ants Profiler http://www.red-gate.com CLR Profiler 2.0 http://www.microsoft.com/downloads/details.aspx?familyid=A362781C-3870-43BE-8926-862B40AA0CD0&displaylang=en Or http://tinyurl.com/ozsgr

.NET Memory Profiler

http://memprofiler.com/

Ants Profiler

http://www.red-gate.com

CLR Profiler 2.0

http://www.microsoft.com/downloads/details.aspx?familyid=A362781C-3870-43BE-8926-862B40AA0CD0&displaylang=en

Or http://tinyurl.com/ozsgr

Resources DevPartner Studio Professional Includes a memory profiler http://www.compuware.com/products/devpartner/studio.htm

DevPartner Studio Professional

Includes a memory profiler

http://www.compuware.com/products/devpartner/studio.htm

Resources Introduction to the CLR Profiler http://msdn.microsoft.com/msdntv/episode.aspx?xml=episodes/en/20050217CLRPS/manifest.xml Profiling Managed Code with the CLR Profiler http://msdn.microsoft.com/msdntv/episode.aspx?xml=episodes/en/20030729clrgn/manifest.xml How To: Use CLR Profiler http://msdn2.microsoft.com/en-us/library/ms979205.aspx CLR Profiler (v1.1) http://www.microsoft.com/downloads/details.aspx?familyid=86ce6052-d7f4-4aeb-9b7a-94635beebdda&displaylang=en

Introduction to the CLR Profiler

http://msdn.microsoft.com/msdntv/episode.aspx?xml=episodes/en/20050217CLRPS/manifest.xml

Profiling Managed Code with the CLR Profiler

http://msdn.microsoft.com/msdntv/episode.aspx?xml=episodes/en/20030729clrgn/manifest.xml

How To: Use CLR Profiler

http://msdn2.microsoft.com/en-us/library/ms979205.aspx

CLR Profiler (v1.1)

http://www.microsoft.com/downloads/details.aspx?familyid=86ce6052-d7f4-4aeb-9b7a-94635beebdda&displaylang=en

Resources Improving Managed Code Performance (P&P) http://msdn2.microsoft.com/en-us/library/ms998547.aspx Code Review: .NET Application Performance http://msdn2.microsoft.com/en-us/library/ms998574.aspx Checklist: Managed Code Performance http://msdn2.microsoft.com/en-us/library/ms979052.aspx Improving .NET Application Performance and Scalability (full Patterns and Practices book) http://msdn2.microsoft.com/en-us/library/ms998530.aspx

Improving Managed Code Performance (P&P)

http://msdn2.microsoft.com/en-us/library/ms998547.aspx

Code Review: .NET Application Performance

http://msdn2.microsoft.com/en-us/library/ms998574.aspx

Checklist: Managed Code Performance

http://msdn2.microsoft.com/en-us/library/ms979052.aspx

Improving .NET Application Performance and Scalability (full Patterns and Practices book)

http://msdn2.microsoft.com/en-us/library/ms998530.aspx

Resources Rico Mariani's Performance Tidbits (Blog) http://blogs.msdn.com/ricom/default.aspx Garbage Collection: Automatic Memory Management in the Microsoft .NET Framework (Jeffery Richter) http://msdn.microsoft.com/msdnmag/issues/1100/gci/ Garbage Collector Basics and Performance Hints (Rico Mariani) http://msdn2.microsoft.com/en-us/library/ms973837.aspx

Rico Mariani's Performance Tidbits (Blog)

http://blogs.msdn.com/ricom/default.aspx

Garbage Collection: Automatic Memory Management in the Microsoft .NET Framework (Jeffery Richter)

http://msdn.microsoft.com/msdnmag/issues/1100/gci/

Garbage Collector Basics and Performance Hints (Rico Mariani)

http://msdn2.microsoft.com/en-us/library/ms973837.aspx

Thank You! Questions?

Questions?

Add a comment

Related pages

Analyze .NET Framework memory issues

Analyze .NET Framework memory issues. ... Excessive memory use can starve the application and the machine of resources if the garbage collector is ...
Read more

Diagnosing memory issues with the new Memory Usage Tool in ...

Diagnosing memory issues with the new Memory Usage ... to analyze memory issues in hybrid applications. ... applications and .NET/WCF ...
Read more

dotMemory: Memory profiler and unit-testing framework for .NET

dotMemory allows you to analyze memory usage in a variety of .NET ... memory usage in your applications right ... individual JetBrains .NET ...
Read more

Using Visual Studio 2013 for analyzing memory issues in ...

The concept of memory leakage in .NET applications is ... for analyzing memory issues in WPF applications ... memory usage after ...
Read more

Memory Leak Analysis For .Net Application

This article exlains what memory leaks in .Net applications are and introduces a ... if the application is small, one can analyze the code and figure out ...
Read more

Memory Usage without Debugging

... see Analyze memory usage ... choose Debug / Start Diagnostics Without Debugging. Select Memory Usage and ... If you discover a memory issue ...
Read more

Hunting And Analyzing High CPU Usage In .NET Application

Hunting And Analyzing High CPU Usage In .NET Application ... high CPU usage of a .NET web application ... memory for the lifetime of the application ...
Read more

Find Memory Leaks using .NET Memory Profiler

Automatically analyze memory usage and highlight potential memory leak issues. The automatic memory analyser will help you locate potential memory leaks ...
Read more

.NET Memory Profiler - In-depth .NET Memory Profiling

Find memory leaks Easily identify memory leaks by collecting and comparing snapshots of .NET memory usage. ... debugging a production code memory issue ...
Read more