Analyzing .NET Application Memory Usage and Issues Using Free and Commercial  Profiling Tools Presented by Greg Sohl © 200...
Memory Issues? Huh? <ul><li>.NET has Garbage Collection. I don’t have to worry about memory anymore! </li></ul><ul><li>Use...
Common .NET Memory Issues <ul><li>Too much allocation </li></ul><ul><li>Memory allocations are long lived </li></ul><ul><l...
Why Use a Profiling Tool? <ul><li>To understand how your allocations correspond with the assumptions made by the GC </li><...
3 Allocation Profilers <ul><li>.NET Memory Profiler – SciTech </li></ul><ul><ul><li>Commercial – best of breed </li></ul><...
Definitions <ul><li>Root – The base object holding references to other objects </li></ul><ul><ul><li>Examples: A static fi...
Sample - Conway’s Game of Life  <ul><li>A simulation of cellular automation.   </li></ul><ul><li>http://en.wikipedia.org/w...
Demo - .NET Memory Profiler <ul><li>Cream of the crop profilers </li></ul><ul><li>Can attach to running processes </li></u...
Demo - CLR Profiler 2.0 <ul><li>For the MacGyver in you. </li></ul><ul><li>A robust tool, without all the modern convenien...
Demo - Ants Profiler <ul><li>Good tool with basic features </li></ul><ul><li>Memory analysis a recent addition to executio...
Resources <ul><li>.NET Memory Profiler </li></ul><ul><ul><li>http://memprofiler.com/ </li></ul></ul><ul><li>Ants Profiler ...
Resources <ul><li>DevPartner Studio Professional </li></ul><ul><ul><li>Includes a memory profiler </li></ul></ul><ul><ul><...
Resources <ul><li>Introduction to the CLR Profiler </li></ul><ul><ul><li>http://msdn.microsoft.com/msdntv/episode.aspx?xml...
Resources <ul><li>Improving Managed Code Performance (P&P) </li></ul><ul><ul><li>http://msdn2.microsoft.com/en-us/library/...
Resources <ul><li>Rico Mariani's Performance Tidbits (Blog) </li></ul><ul><ul><li>http://blogs.msdn.com/ricom/default.aspx...
Thank You!  <ul><li>Questions? </li></ul>
Upcoming SlideShare
Loading in …5
×

Analyzing .Net Application Memory Usage And Issues

3,731 views

Published on

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.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,731
On SlideShare
0
From Embeds
0
Number of Embeds
51
Actions
Shares
0
Downloads
0
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

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>

×