Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Upcoming SlideShare
.NET Memory Primer (Martin Kulov)
Next

1

Share

Analyzing .Net Application Memory Usage And Issues

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.

Related Books

Free with a 30 day trial from Scribd

See all

Analyzing .Net Application Memory Usage And Issues

  1. 1. Analyzing .NET Application Memory Usage and Issues Using Free and Commercial Profiling Tools Presented by Greg Sohl © 2006, Gregory M. Sohl
  2. 2. Memory Issues? Huh? <ul><li>.NET has Garbage Collection. I don’t have to worry about memory anymore! </li></ul><ul><li>Users have lots of memory now. I don’t have to worry about using lots of memory anymore! </li></ul><ul><li>Windows has virtual memory space. I don’t have to worry about using lots of memory anymore! </li></ul>
  3. 3. Common .NET Memory Issues <ul><li>Too much allocation </li></ul><ul><li>Memory allocations are long lived </li></ul><ul><li>Managed memory leaks – reference leaks </li></ul><ul><li>Work “with” the Garbage Collector. It’s your friend - but only if you are nice to it. </li></ul>
  4. 4. Why Use a Profiling Tool? <ul><li>To understand how your allocations correspond with the assumptions made by the GC </li></ul><ul><li>Track unintentional references to instances (leaks) </li></ul><ul><li>Track references that are being held too long </li></ul>
  5. 5. 3 Allocation Profilers <ul><li>.NET Memory Profiler – SciTech </li></ul><ul><ul><li>Commercial – best of breed </li></ul></ul><ul><li>Ants Profiler – Red Gate </li></ul><ul><ul><li>Commercial – Useful, but light weight feature set </li></ul></ul><ul><li>CLR Profiler 2.0 – Microsoft </li></ul><ul><ul><li>Free – Powerful, but challenging to use </li></ul></ul><ul><li>Others listed in resources </li></ul>
  6. 6. Definitions <ul><li>Root – The base object holding references to other objects </li></ul><ul><ul><li>Examples: A static field, a local variable or a method parameter. </li></ul></ul><ul><li>Root Path - The path of referees from the selected instance to a root </li></ul><ul><li>Garbage Collection – The process by which objects with no root (unreachable objects) are cleaned up from the heap. </li></ul>
  7. 7. Sample - Conway’s Game of Life <ul><li>A simulation of cellular automation. </li></ul><ul><li>http://en.wikipedia.org/wiki/Conway's_Game_of_Life </li></ul>Pulsar Pattern
  8. 8. Demo - .NET Memory Profiler <ul><li>Cream of the crop profilers </li></ul><ul><li>Can attach to running processes </li></ul><ul><li>Show native memory usage </li></ul><ul><li>Great real-time view </li></ul><ul><li>Copy grids to clipboard </li></ul><ul><li>Low impact mode </li></ul>
  9. 9. Demo - CLR Profiler 2.0 <ul><li>For the MacGyver in you. </li></ul><ul><li>A robust tool, without all the modern conveniences. </li></ul>
  10. 10. Demo - Ants Profiler <ul><li>Good tool with basic features </li></ul><ul><li>Memory analysis a recent addition to execution analysis </li></ul><ul><li>No real-time or IDisposble analysis </li></ul><ul><li>Best thread support </li></ul>
  11. 11. Resources <ul><li>.NET Memory Profiler </li></ul><ul><ul><li>http://memprofiler.com/ </li></ul></ul><ul><li>Ants Profiler </li></ul><ul><ul><li>http://www.red-gate.com </li></ul></ul><ul><li>CLR Profiler 2.0 </li></ul><ul><ul><li>http://www.microsoft.com/downloads/details.aspx?familyid=A362781C-3870-43BE-8926-862B40AA0CD0&displaylang=en </li></ul></ul><ul><ul><li>Or http://tinyurl.com/ozsgr </li></ul></ul>
  12. 12. Resources <ul><li>DevPartner Studio Professional </li></ul><ul><ul><li>Includes a memory profiler </li></ul></ul><ul><ul><li>http://www.compuware.com/products/devpartner/studio.htm </li></ul></ul>
  13. 13. Resources <ul><li>Introduction to the CLR Profiler </li></ul><ul><ul><li>http://msdn.microsoft.com/msdntv/episode.aspx?xml=episodes/en/20050217CLRPS/manifest.xml </li></ul></ul><ul><li>Profiling Managed Code with the CLR Profiler </li></ul><ul><ul><li>http://msdn.microsoft.com/msdntv/episode.aspx?xml=episodes/en/20030729clrgn/manifest.xml </li></ul></ul><ul><li>How To: Use CLR Profiler </li></ul><ul><ul><li>http://msdn2.microsoft.com/en-us/library/ms979205.aspx </li></ul></ul><ul><li>CLR Profiler (v1.1) </li></ul><ul><ul><li>http://www.microsoft.com/downloads/details.aspx?familyid=86ce6052-d7f4-4aeb-9b7a-94635beebdda&displaylang=en </li></ul></ul>
  14. 14. Resources <ul><li>Improving Managed Code Performance (P&P) </li></ul><ul><ul><li>http://msdn2.microsoft.com/en-us/library/ms998547.aspx </li></ul></ul><ul><li>Code Review: .NET Application Performance </li></ul><ul><ul><li>http://msdn2.microsoft.com/en-us/library/ms998574.aspx </li></ul></ul><ul><li>Checklist: Managed Code Performance </li></ul><ul><ul><li>http://msdn2.microsoft.com/en-us/library/ms979052.aspx </li></ul></ul><ul><li>Improving .NET Application Performance and Scalability (full Patterns and Practices book) </li></ul><ul><ul><li>http://msdn2.microsoft.com/en-us/library/ms998530.aspx </li></ul></ul>
  15. 15. Resources <ul><li>Rico Mariani's Performance Tidbits (Blog) </li></ul><ul><ul><li>http://blogs.msdn.com/ricom/default.aspx </li></ul></ul><ul><li>Garbage Collection: Automatic Memory Management in the Microsoft .NET Framework (Jeffery Richter) </li></ul><ul><ul><li>http://msdn.microsoft.com/msdnmag/issues/1100/gci/ </li></ul></ul><ul><li>Garbage Collector Basics and Performance Hints (Rico Mariani) </li></ul><ul><ul><li>http://msdn2.microsoft.com/en-us/library/ms973837.aspx </li></ul></ul>
  16. 16. Thank You! <ul><li>Questions? </li></ul>
  • lalitkale

    Sep. 18, 2013

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.

Views

Total views

3,873

On Slideshare

0

From embeds

0

Number of embeds

51

Actions

Downloads

0

Shares

0

Comments

0

Likes

1

×