SlideShare a Scribd company logo
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!
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.
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
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
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.
Sample - Conway’s Game of Life  A simulation of cellular automation.   http://en.wikipedia.org/wiki/Conway's_Game_of_Life Pulsar Pattern
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
Demo - CLR Profiler 2.0 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
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
Resources 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
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
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
Thank You!  Questions?

More Related Content

PDF
.NET Memory Primer (Martin Kulov)
PPTX
.Net memory management ndc london
PPT
Garbage Collection In Micorosoft
PDF
Memory management
PPTX
Memory profiler and garbage collector in C#
PPTX
JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory...
PPTX
Exploring .NET memory management - A trip down memory lane - Copenhagen .NET ...
PPTX
JetBrains Australia 2019 - Exploring .NET’s memory management – a trip down m...
.NET Memory Primer (Martin Kulov)
.Net memory management ndc london
Garbage Collection In Micorosoft
Memory management
Memory profiler and garbage collector in C#
JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory...
Exploring .NET memory management - A trip down memory lane - Copenhagen .NET ...
JetBrains Australia 2019 - Exploring .NET’s memory management – a trip down m...

Similar to Analyzing .Net Application Memory Usage And Issues (20)

PPTX
Exploring .NET memory management - JetBrains webinar
PPTX
DotNetFest - Let’s refresh our memory! Memory management in .NET
PDF
.NET Fest 2018. Maarten Balliauw. Let’s refresh our memory! Memory management...
PPTX
.Net debugging 2017
PPTX
ConFoo - Exploring .NET’s memory management – a trip down memory lane
DOC
Memory management
PDF
Kostiantyn Yelisavenko "Mastering Macro Benchmarking in .NET"
PPTX
Debugging performance issues, memory issues and crashes in .net applications rev
PDF
Look Mommy, no GC! (BrightSource)
PDF
TechGIG_Memory leaks in_java_webnair_26th_july_2012
PPTX
Garbage collection in C#,important topic
PPTX
Performance In The .Net World
PPT
Practical lessons in memory analysis
PPTX
Exploring .NET memory management (iSense)
PPTX
CodeStock - Exploring .NET memory management - a trip down memory lane
PDF
Ps ts 4118-304118_230-1_fin_v1
PPTX
01class_object_references & 02Generation_GC.pptx
PDF
Visual Studio Profiler
PPTX
.Net Architecture and Performance Tuning
PDF
Self-Aware Applications: Automatic Production Monitoring (NDC Sydney 2017)
Exploring .NET memory management - JetBrains webinar
DotNetFest - Let’s refresh our memory! Memory management in .NET
.NET Fest 2018. Maarten Balliauw. Let’s refresh our memory! Memory management...
.Net debugging 2017
ConFoo - Exploring .NET’s memory management – a trip down memory lane
Memory management
Kostiantyn Yelisavenko "Mastering Macro Benchmarking in .NET"
Debugging performance issues, memory issues and crashes in .net applications rev
Look Mommy, no GC! (BrightSource)
TechGIG_Memory leaks in_java_webnair_26th_july_2012
Garbage collection in C#,important topic
Performance In The .Net World
Practical lessons in memory analysis
Exploring .NET memory management (iSense)
CodeStock - Exploring .NET memory management - a trip down memory lane
Ps ts 4118-304118_230-1_fin_v1
01class_object_references & 02Generation_GC.pptx
Visual Studio Profiler
.Net Architecture and Performance Tuning
Self-Aware Applications: Automatic Production Monitoring (NDC Sydney 2017)
Ad

More from Greg Sohl (11)

PPTX
A DSL for Your API
PPT
.NET Overview
PPTX
Cool .NET tools, techniques and libraries
PPTX
Net serialization
PPTX
RESTful APIs in .NET
PPTX
A great clash of symbols
PPTX
What’s new in Visual Studio 2010 debugging
PPT
Automated Unit Testing and TDD
PPT
Application Security Part 1 Threat Defense In Client Server Applications ...
PPT
.NET Recommended Resources
PPT
Object Oriented Programming In .Net
A DSL for Your API
.NET Overview
Cool .NET tools, techniques and libraries
Net serialization
RESTful APIs in .NET
A great clash of symbols
What’s new in Visual Studio 2010 debugging
Automated Unit Testing and TDD
Application Security Part 1 Threat Defense In Client Server Applications ...
.NET Recommended Resources
Object Oriented Programming In .Net
Ad

Recently uploaded (20)

PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Machine learning based COVID-19 study performance prediction
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
Cloud computing and distributed systems.
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPT
Teaching material agriculture food technology
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
Spectroscopy.pptx food analysis technology
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Reach Out and Touch Someone: Haptics and Empathic Computing
Network Security Unit 5.pdf for BCA BBA.
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Chapter 3 Spatial Domain Image Processing.pdf
NewMind AI Weekly Chronicles - August'25-Week II
Machine learning based COVID-19 study performance prediction
Per capita expenditure prediction using model stacking based on satellite ima...
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Cloud computing and distributed systems.
Mobile App Security Testing_ A Comprehensive Guide.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
Encapsulation_ Review paper, used for researhc scholars
MIND Revenue Release Quarter 2 2025 Press Release
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Teaching material agriculture food technology
Spectral efficient network and resource selection model in 5G networks
Spectroscopy.pptx food analysis technology
Build a system with the filesystem maintained by OSTree @ COSCUP 2025

Analyzing .Net Application Memory Usage And Issues

  • 1. Analyzing .NET Application Memory Usage and Issues Using Free and Commercial Profiling Tools Presented by Greg Sohl © 2006, Gregory M. Sohl
  • 2. 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!
  • 3. 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.
  • 4. 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
  • 5. 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
  • 6. 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.
  • 7. Sample - Conway’s Game of Life A simulation of cellular automation. http://en.wikipedia.org/wiki/Conway's_Game_of_Life Pulsar Pattern
  • 8. 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
  • 9. Demo - CLR Profiler 2.0 For the MacGyver in you. A robust tool, without all the modern conveniences.
  • 10. 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
  • 11. 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
  • 12. Resources DevPartner Studio Professional Includes a memory profiler http://www.compuware.com/products/devpartner/studio.htm
  • 13. 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
  • 14. 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
  • 15. 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
  • 16. Thank You! Questions?