dotMemory 4 - What's inside?

Maarten Balliauw
Maarten BalliauwDeveloper Advocate
dotMemory 4
what's inside
Maarten Balliauw
Technical Evangelist
maarten.balliauw@jetbrains.com
@maartenballiauw
Who am I?
Maarten Balliauw
Belgium (Antwerp)
Technical Evangelist, JetBrains
Focus on web
ASP.NET MVC, Windows Azure, ...
PHP, ...
Big passion: Cloud (Windows Azure)
Home brewer
http://blog.maartenballiauw.be
@maartenballiauw
Have a question?
Use the Question Pane. We’ll try and answer as we go along
Recording

Recording will start now….
Agenda
Why use a tool like dotMemory?
What happened to dotTrace Memory?
.NET Memory Management 101

Exploring dotMemory
UI concepts
Finding a memory leak
Analyzing memory traffic
Why use a tool like dotMemory?
.NET creates numerous objects in memory, even for simple programs

Memory is constantly being assigned and released (memory traffic)
What if some memory is retained while we expected it to be released?
Why use a tool like dotMemory?
dotMemory tries to answer:
Why is this object still in memory?
What causes the memory leak?

What takes so much memory?
How much memory traffic is going on?
Are there any memory allocation/distribution patterns violated?
E.g. event handlers not being unregistered, sparse arrays, …

Don’t just use it when things go wrong!
What does dotMemory do for me?
Collect memory snapshot information
Info about all objects on the managed heap at the moment a snapshot is
taken
Collect memory traffic information
How much memory is allocated / released
Analyze these during a profiling session
What happened to dotTrace Memory?
Did you even know we had a memory profiler before?
dotTrace Memory 3.5
Hasn’t had any significant updates since 2010
Complex to work with
Time for a fresh memory profiler: dotMemory 4!
Friendly – new UI displays complex information in an easy way
Powerful – works on very large programs (we use it on R#)
.NET Memory Management 101
Memory Allocation
.NET runtime reserves region of address space for every new process
managed heap

Objects are allocated in the heap
Allocating memory is fast, it’s just adding a pointer
Some unmanaged memory is also consumed (not GC-ed)
.NET CLR, Dynamic libraries, Graphics buffer, …

Memory Release or “Garbage Collection” (GC)
Generations
Large Object Heap
See http://confluence.jetbrains.com/display/NETCOM/What+You+Should+Know+about+.NET+Memory+Management
.NET Memory Management 101
Memory Allocation
Memory Release or “Garbage Collection” (GC)
GC releases objects no longer in use by examining application roots

GC builds a graph that contains all the objects that are reachable from
these roots.
Object unreachable? GC removes the object from the heap, releasing
memory
After the object is removed, GC compacts reachable objects in memory.
Generations
Large Object Heap
See http://confluence.jetbrains.com/display/NETCOM/What+You+Should+Know+about+.NET+Memory+Management
.NET Memory Management 101
Memory Allocation
Memory Release or “Garbage Collection” (GC)
Generations
Managed heap divided in segments: generation 0, 1 and 2
New objects go into Gen 0
Gen 0 full? Perform GC and promote all reachable objects to Gen 1. This is typically pretty
fast.
Gen 1 full? Perform GC on Gen 1 and Gen 0. Promote all reachable objects to Gen 2.
Gen 2 full? Perform full GC (2, 1, 0). If not enough memory for new allocations, throws

OutOfMemoryException

Full GC has performance impact since all objects in managed heap are verified.

Large Object Heap
See http://confluence.jetbrains.com/display/NETCOM/What+You+Should+Know+about+.NET+Memory+Management
.NET Memory Management 101
Memory Allocation
Memory Release or “Garbage Collection” (GC)
Generations
Generation 0

Generation 1

Generation 2

Short-lived objects (e.g. Local
variables)

In-between objects

Long-lived objects (e.g. App’s
main form)

Large Object Heap
See http://confluence.jetbrains.com/display/NETCOM/What+You+Should+Know+about+.NET+Memory+Management
.NET Memory Management 101
Memory Allocation
Memory Release or “Garbage Collection” (GC)
Generations
Large Object Heap
Large objects (>85KB) stored in separate segment of managed heap: Large

Object Heap (LOH)

Objects in LOH collected only during full garbage collection
Survived objects in LOH are not compacted (by default). This means that
LOH becomes fragmented over time.
Fragmentation can cause OutOfMemoryException
See http://confluence.jetbrains.com/display/NETCOM/What+You+Should+Know+about+.NET+Memory+Management
A look at dotMemory 4

demo

Exploring the UI
The general idea
Let’s see if we can find what’s wrong!

demo

Investigating a
memory leak
What just happened?
public AdWindow(Window owner)
{
// ...

DispatcherTimer[]

// Run the timer that changes the ad's image
adTimer = new DispatcherTimer();
adTimer.Interval = TimeSpan.FromSeconds(3);
adTimer.Tick += ChangeAds;
adTimer.Start();

DispatcherTimer
.Tick

AdWindow

}

adTimer.Tick -= ChangeAds;
How is the GC affecting our application?

demo

Analyzing
memory traffic
What just happened?
for (int i = 0; i < ....

StringReverse
r

StringReverse
r

StringReverse
r
Why use a tool like dotMemory?
Why is this object still in memory?
What takes so much memory?
How much memory traffic is going on?

Are there any memory allocation/distribution patterns violated?
Questions

Me, having a
question
Resources
Try dotMemory 4 now!
http://confluence.jetbrains.com/display/NetProf/dotMemory+4.0+EAP
Give us feedback!
Tutorials
dotMemory Manual http://bit.ly/dotmemory-manual
Getting started http://bit.ly/dotmemory-gettingstarted
Finding memory leaks http://bit.ly/dotmemory-findingmemleak
Analyzing memory traffic http://bit.ly/dotmemory-memorytraffic
More info
Home

http://jetbrains.com/dottrace

Feedback

maarten.balliauw@jetbrains.com
http://youtrack.jetbrains.com/issues/DMRY

Videos

http://www.youtube.com/jetbrainstv
.NET Tools Channel

Blog

http://blog.jetbrains.com/dotnet
Thank you for joining us!
Want to learn more?
Follow @dottrace on Twitter
to learn product tips and register
for upcoming webinars
dotMemory 4 - What's inside?
1 of 26

Recommended

Garbage collection algorithms by
Garbage collection algorithmsGarbage collection algorithms
Garbage collection algorithmsachinth
11.4K views14 slides
Virtual memory by
Virtual memoryVirtual memory
Virtual memoryAnuj Modi
37.2K views15 slides
Virtual Memory by
Virtual MemoryVirtual Memory
Virtual MemoryArchith777
1.3K views24 slides
Programming language paradigms by
Programming language paradigmsProgramming language paradigms
Programming language paradigmsAshok Raj
119 views56 slides
Cache memory by
Cache memoryCache memory
Cache memoryGeorge Thomas
2.4K views6 slides
MacOS memory allocator (libmalloc) Exploitation by
MacOS memory allocator (libmalloc) ExploitationMacOS memory allocator (libmalloc) Exploitation
MacOS memory allocator (libmalloc) ExploitationAngel Boy
4.6K views115 slides

More Related Content

What's hot

Operating system Memory management by
Operating system Memory management Operating system Memory management
Operating system Memory management Shashank Asthana
4.2K views11 slides
MEMORY MANAGEMENT by
MEMORY MANAGEMENTMEMORY MANAGEMENT
MEMORY MANAGEMENTJOLLUSUDARSHANREDDY
869 views12 slides
Mac memory overview by
Mac memory overviewMac memory overview
Mac memory overviewSKMohamedKasim
152 views14 slides
Valgrind by
ValgrindValgrind
Valgrindaidanshribman
5.5K views83 slides
Unix Memory Management - Operating Systems by
Unix Memory Management - Operating SystemsUnix Memory Management - Operating Systems
Unix Memory Management - Operating SystemsDrishti Bhalla
11.5K views34 slides
Anonymous functions in JavaScript by
Anonymous functions in JavaScriptAnonymous functions in JavaScript
Anonymous functions in JavaScriptMohammed Sazid Al Rashid
1.3K views12 slides

What's hot(20)

Operating system Memory management by Shashank Asthana
Operating system Memory management Operating system Memory management
Operating system Memory management
Shashank Asthana4.2K views
Unix Memory Management - Operating Systems by Drishti Bhalla
Unix Memory Management - Operating SystemsUnix Memory Management - Operating Systems
Unix Memory Management - Operating Systems
Drishti Bhalla11.5K views
Virtual memory presentation by Ranjeet Kumar
Virtual memory presentationVirtual memory presentation
Virtual memory presentation
Ranjeet Kumar823 views
Introduction to Machine Learning with Spark by datamantra
Introduction to Machine Learning with SparkIntroduction to Machine Learning with Spark
Introduction to Machine Learning with Spark
datamantra6.9K views
Operating system memory management by rprajat007
Operating system memory managementOperating system memory management
Operating system memory management
rprajat0075.8K views
Memory Organization by Kamal Acharya
Memory OrganizationMemory Organization
Memory Organization
Kamal Acharya31.5K views
C++11: Rvalue References, Move Semantics, Perfect Forwarding by Francesco Casalegno
C++11: Rvalue References, Move Semantics, Perfect ForwardingC++11: Rvalue References, Move Semantics, Perfect Forwarding
C++11: Rvalue References, Move Semantics, Perfect Forwarding
Introduction to system programming by sonalikharade3
Introduction to system programmingIntroduction to system programming
Introduction to system programming
sonalikharade3549 views
Memory Management & Garbage Collection by Abhishek Sur
Memory Management & Garbage CollectionMemory Management & Garbage Collection
Memory Management & Garbage Collection
Abhishek Sur2.6K views
Building a Streaming Microservice Architecture: with Apache Spark Structured ... by Databricks
Building a Streaming Microservice Architecture: with Apache Spark Structured ...Building a Streaming Microservice Architecture: with Apache Spark Structured ...
Building a Streaming Microservice Architecture: with Apache Spark Structured ...
Databricks1.6K views
Cache memory ppt by Arpita Naik
Cache memory ppt  Cache memory ppt
Cache memory ppt
Arpita Naik7.9K views

Similar to dotMemory 4 - What's inside?

JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory... by
JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory...JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory...
JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory...Maarten Balliauw
1.1K views35 slides
Exploring .NET memory management - JetBrains webinar by
Exploring .NET memory management - JetBrains webinarExploring .NET memory management - JetBrains webinar
Exploring .NET memory management - JetBrains webinarMaarten Balliauw
1.3K views46 slides
.NET Fest 2018. Maarten Balliauw. Let’s refresh our memory! Memory management... by
.NET Fest 2018. Maarten Balliauw. Let’s refresh our memory! Memory management....NET Fest 2018. Maarten Balliauw. Let’s refresh our memory! Memory management...
.NET Fest 2018. Maarten Balliauw. Let’s refresh our memory! Memory management...NETFest
90 views42 slides
Exploring .NET memory management - A trip down memory lane - Copenhagen .NET ... by
Exploring .NET memory management - A trip down memory lane - Copenhagen .NET ...Exploring .NET memory management - A trip down memory lane - Copenhagen .NET ...
Exploring .NET memory management - A trip down memory lane - Copenhagen .NET ...Maarten Balliauw
757 views46 slides
DotNetFest - Let’s refresh our memory! Memory management in .NET by
DotNetFest - Let’s refresh our memory! Memory management in .NETDotNetFest - Let’s refresh our memory! Memory management in .NET
DotNetFest - Let’s refresh our memory! Memory management in .NETMaarten Balliauw
480 views42 slides
Exploring .NET memory management (iSense) by
Exploring .NET memory management (iSense)Exploring .NET memory management (iSense)
Exploring .NET memory management (iSense)Maarten Balliauw
381 views38 slides

Similar to dotMemory 4 - What's inside?(20)

JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory... by Maarten Balliauw
JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory...JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory...
JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory...
Maarten Balliauw1.1K views
Exploring .NET memory management - JetBrains webinar by Maarten Balliauw
Exploring .NET memory management - JetBrains webinarExploring .NET memory management - JetBrains webinar
Exploring .NET memory management - JetBrains webinar
Maarten Balliauw1.3K views
.NET Fest 2018. Maarten Balliauw. Let’s refresh our memory! Memory management... by NETFest
.NET Fest 2018. Maarten Balliauw. Let’s refresh our memory! Memory management....NET Fest 2018. Maarten Balliauw. Let’s refresh our memory! Memory management...
.NET Fest 2018. Maarten Balliauw. Let’s refresh our memory! Memory management...
NETFest90 views
Exploring .NET memory management - A trip down memory lane - Copenhagen .NET ... by Maarten Balliauw
Exploring .NET memory management - A trip down memory lane - Copenhagen .NET ...Exploring .NET memory management - A trip down memory lane - Copenhagen .NET ...
Exploring .NET memory management - A trip down memory lane - Copenhagen .NET ...
Maarten Balliauw757 views
DotNetFest - Let’s refresh our memory! Memory management in .NET by Maarten Balliauw
DotNetFest - Let’s refresh our memory! Memory management in .NETDotNetFest - Let’s refresh our memory! Memory management in .NET
DotNetFest - Let’s refresh our memory! Memory management in .NET
Maarten Balliauw480 views
Exploring .NET memory management (iSense) by Maarten Balliauw
Exploring .NET memory management (iSense)Exploring .NET memory management (iSense)
Exploring .NET memory management (iSense)
Maarten Balliauw381 views
Java Garbage Collection, Monitoring, and Tuning by Carol McDonald
Java Garbage Collection, Monitoring, and TuningJava Garbage Collection, Monitoring, and Tuning
Java Garbage Collection, Monitoring, and Tuning
Carol McDonald22.2K views
Memory profiler and garbage collector in C# by Wipro
Memory profiler and garbage collector in C#Memory profiler and garbage collector in C#
Memory profiler and garbage collector in C#
Wipro279 views
CodeStock - Exploring .NET memory management - a trip down memory lane by Maarten Balliauw
CodeStock - Exploring .NET memory management - a trip down memory laneCodeStock - Exploring .NET memory management - a trip down memory lane
CodeStock - Exploring .NET memory management - a trip down memory lane
Maarten Balliauw1.9K views
Eclipse Memory Analyzer by nayashkova
Eclipse Memory AnalyzerEclipse Memory Analyzer
Eclipse Memory Analyzer
nayashkova4.3K views
Performance #1: Memory by Yonatan Levin
Performance #1: MemoryPerformance #1: Memory
Performance #1: Memory
Yonatan Levin1.4K views
ConFoo - Exploring .NET’s memory management – a trip down memory lane by Maarten Balliauw
ConFoo - Exploring .NET’s memory management – a trip down memory laneConFoo - Exploring .NET’s memory management – a trip down memory lane
ConFoo - Exploring .NET’s memory management – a trip down memory lane
Maarten Balliauw523 views
Memory Leaks in Android Applications by Lokesh Ponnada
Memory Leaks in Android ApplicationsMemory Leaks in Android Applications
Memory Leaks in Android Applications
Lokesh Ponnada1K views
Eclipse Memory Analyzer - More Than Just a Heap Walker by guest62fd60c
Eclipse Memory Analyzer - More Than Just a Heap WalkerEclipse Memory Analyzer - More Than Just a Heap Walker
Eclipse Memory Analyzer - More Than Just a Heap Walker
guest62fd60c6.1K views
.NET Core, ASP.NET Core Course, Session 4 by aminmesbahi
.NET Core, ASP.NET Core Course, Session 4.NET Core, ASP.NET Core Course, Session 4
.NET Core, ASP.NET Core Course, Session 4
aminmesbahi467 views
Mobile Developer Summit 2012, Pune by Bhuvan Khanna
Mobile Developer Summit 2012, PuneMobile Developer Summit 2012, Pune
Mobile Developer Summit 2012, Pune
Bhuvan Khanna234 views
Learn Microsoft Asp.Net Garbage Collection by Diya Singh
Learn Microsoft Asp.Net Garbage CollectionLearn Microsoft Asp.Net Garbage Collection
Learn Microsoft Asp.Net Garbage Collection
Diya Singh75 views
Designing A Project Using Java Programming by Katy Allen
Designing A Project Using Java ProgrammingDesigning A Project Using Java Programming
Designing A Project Using Java Programming
Katy Allen2 views

More from Maarten Balliauw

Nerd sniping myself into a rabbit hole... Streaming online audio to a Sonos s... by
Nerd sniping myself into a rabbit hole... Streaming online audio to a Sonos s...Nerd sniping myself into a rabbit hole... Streaming online audio to a Sonos s...
Nerd sniping myself into a rabbit hole... Streaming online audio to a Sonos s...Maarten Balliauw
360 views64 slides
Building a friendly .NET SDK to connect to Space by
Building a friendly .NET SDK to connect to SpaceBuilding a friendly .NET SDK to connect to Space
Building a friendly .NET SDK to connect to SpaceMaarten Balliauw
182 views47 slides
Microservices for building an IDE - The innards of JetBrains Rider - NDC Oslo... by
Microservices for building an IDE - The innards of JetBrains Rider - NDC Oslo...Microservices for building an IDE - The innards of JetBrains Rider - NDC Oslo...
Microservices for building an IDE - The innards of JetBrains Rider - NDC Oslo...Maarten Balliauw
406 views52 slides
Indexing and searching NuGet.org with Azure Functions and Search - .NET fwday... by
Indexing and searching NuGet.org with Azure Functions and Search - .NET fwday...Indexing and searching NuGet.org with Azure Functions and Search - .NET fwday...
Indexing and searching NuGet.org with Azure Functions and Search - .NET fwday...Maarten Balliauw
180 views32 slides
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain... by
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...Maarten Balliauw
326 views53 slides
JetBrains Australia 2019 - Exploring .NET’s memory management – a trip down m... by
JetBrains Australia 2019 - Exploring .NET’s memory management – a trip down m...JetBrains Australia 2019 - Exploring .NET’s memory management – a trip down m...
JetBrains Australia 2019 - Exploring .NET’s memory management – a trip down m...Maarten Balliauw
280 views42 slides

More from Maarten Balliauw(20)

Nerd sniping myself into a rabbit hole... Streaming online audio to a Sonos s... by Maarten Balliauw
Nerd sniping myself into a rabbit hole... Streaming online audio to a Sonos s...Nerd sniping myself into a rabbit hole... Streaming online audio to a Sonos s...
Nerd sniping myself into a rabbit hole... Streaming online audio to a Sonos s...
Maarten Balliauw360 views
Building a friendly .NET SDK to connect to Space by Maarten Balliauw
Building a friendly .NET SDK to connect to SpaceBuilding a friendly .NET SDK to connect to Space
Building a friendly .NET SDK to connect to Space
Maarten Balliauw182 views
Microservices for building an IDE - The innards of JetBrains Rider - NDC Oslo... by Maarten Balliauw
Microservices for building an IDE - The innards of JetBrains Rider - NDC Oslo...Microservices for building an IDE - The innards of JetBrains Rider - NDC Oslo...
Microservices for building an IDE - The innards of JetBrains Rider - NDC Oslo...
Maarten Balliauw406 views
Indexing and searching NuGet.org with Azure Functions and Search - .NET fwday... by Maarten Balliauw
Indexing and searching NuGet.org with Azure Functions and Search - .NET fwday...Indexing and searching NuGet.org with Azure Functions and Search - .NET fwday...
Indexing and searching NuGet.org with Azure Functions and Search - .NET fwday...
Maarten Balliauw180 views
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain... by Maarten Balliauw
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...
Maarten Balliauw326 views
JetBrains Australia 2019 - Exploring .NET’s memory management – a trip down m... by Maarten Balliauw
JetBrains Australia 2019 - Exploring .NET’s memory management – a trip down m...JetBrains Australia 2019 - Exploring .NET’s memory management – a trip down m...
JetBrains Australia 2019 - Exploring .NET’s memory management – a trip down m...
Maarten Balliauw280 views
.NET Conf 2019 - Indexing and searching NuGet.org with Azure Functions and Se... by Maarten Balliauw
.NET Conf 2019 - Indexing and searching NuGet.org with Azure Functions and Se....NET Conf 2019 - Indexing and searching NuGet.org with Azure Functions and Se...
.NET Conf 2019 - Indexing and searching NuGet.org with Azure Functions and Se...
Maarten Balliauw290 views
CloudBurst 2019 - Indexing and searching NuGet.org with Azure Functions and S... by Maarten Balliauw
CloudBurst 2019 - Indexing and searching NuGet.org with Azure Functions and S...CloudBurst 2019 - Indexing and searching NuGet.org with Azure Functions and S...
CloudBurst 2019 - Indexing and searching NuGet.org with Azure Functions and S...
Maarten Balliauw564 views
NDC Oslo 2019 - Indexing and searching NuGet.org with Azure Functions and Search by Maarten Balliauw
NDC Oslo 2019 - Indexing and searching NuGet.org with Azure Functions and SearchNDC Oslo 2019 - Indexing and searching NuGet.org with Azure Functions and Search
NDC Oslo 2019 - Indexing and searching NuGet.org with Azure Functions and Search
Maarten Balliauw958 views
Approaches for application request throttling - Cloud Developer Days Poland by Maarten Balliauw
Approaches for application request throttling - Cloud Developer Days PolandApproaches for application request throttling - Cloud Developer Days Poland
Approaches for application request throttling - Cloud Developer Days Poland
Maarten Balliauw1.1K views
Indexing and searching NuGet.org with Azure Functions and Search - Cloud Deve... by Maarten Balliauw
Indexing and searching NuGet.org with Azure Functions and Search - Cloud Deve...Indexing and searching NuGet.org with Azure Functions and Search - Cloud Deve...
Indexing and searching NuGet.org with Azure Functions and Search - Cloud Deve...
Maarten Balliauw1.1K views
Approaches for application request throttling - dotNetCologne by Maarten Balliauw
Approaches for application request throttling - dotNetCologneApproaches for application request throttling - dotNetCologne
Approaches for application request throttling - dotNetCologne
Maarten Balliauw246 views
ConFoo Montreal - Microservices for building an IDE - The innards of JetBrain... by Maarten Balliauw
ConFoo Montreal - Microservices for building an IDE - The innards of JetBrain...ConFoo Montreal - Microservices for building an IDE - The innards of JetBrain...
ConFoo Montreal - Microservices for building an IDE - The innards of JetBrain...
Maarten Balliauw1.2K views
ConFoo Montreal - Approaches for application request throttling by Maarten Balliauw
ConFoo Montreal - Approaches for application request throttlingConFoo Montreal - Approaches for application request throttling
ConFoo Montreal - Approaches for application request throttling
Maarten Balliauw1.2K views
Microservices for building an IDE – The innards of JetBrains Rider - TechDays... by Maarten Balliauw
Microservices for building an IDE – The innards of JetBrains Rider - TechDays...Microservices for building an IDE – The innards of JetBrains Rider - TechDays...
Microservices for building an IDE – The innards of JetBrains Rider - TechDays...
Maarten Balliauw10.5K views
VISUG - Approaches for application request throttling by Maarten Balliauw
VISUG - Approaches for application request throttlingVISUG - Approaches for application request throttling
VISUG - Approaches for application request throttling
Maarten Balliauw817 views
What is going on - Application diagnostics on Azure - TechDays Finland by Maarten Balliauw
What is going on - Application diagnostics on Azure - TechDays FinlandWhat is going on - Application diagnostics on Azure - TechDays Finland
What is going on - Application diagnostics on Azure - TechDays Finland
Maarten Balliauw746 views
Approaches to application request throttling by Maarten Balliauw
Approaches to application request throttlingApproaches to application request throttling
Approaches to application request throttling
Maarten Balliauw1.6K views
NuGet beyond Hello World - DotNext Piter 2017 by Maarten Balliauw
NuGet beyond Hello World - DotNext Piter 2017NuGet beyond Hello World - DotNext Piter 2017
NuGet beyond Hello World - DotNext Piter 2017
Maarten Balliauw702 views

Recently uploaded

Data Integrity for Banking and Financial Services by
Data Integrity for Banking and Financial ServicesData Integrity for Banking and Financial Services
Data Integrity for Banking and Financial ServicesPrecisely
76 views26 slides
CloudStack Managed User Data and Demo - Harikrishna Patnala - ShapeBlue by
CloudStack Managed User Data and Demo - Harikrishna Patnala - ShapeBlueCloudStack Managed User Data and Demo - Harikrishna Patnala - ShapeBlue
CloudStack Managed User Data and Demo - Harikrishna Patnala - ShapeBlueShapeBlue
68 views13 slides
MVP and prioritization.pdf by
MVP and prioritization.pdfMVP and prioritization.pdf
MVP and prioritization.pdfrahuldharwal141
39 views8 slides
Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ... by
Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ...Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ...
Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ...ShapeBlue
52 views10 slides
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue by
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlueVNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlueShapeBlue
134 views54 slides
Business Analyst Series 2023 - Week 4 Session 7 by
Business Analyst Series 2023 -  Week 4 Session 7Business Analyst Series 2023 -  Week 4 Session 7
Business Analyst Series 2023 - Week 4 Session 7DianaGray10
110 views31 slides

Recently uploaded(20)

Data Integrity for Banking and Financial Services by Precisely
Data Integrity for Banking and Financial ServicesData Integrity for Banking and Financial Services
Data Integrity for Banking and Financial Services
Precisely76 views
CloudStack Managed User Data and Demo - Harikrishna Patnala - ShapeBlue by ShapeBlue
CloudStack Managed User Data and Demo - Harikrishna Patnala - ShapeBlueCloudStack Managed User Data and Demo - Harikrishna Patnala - ShapeBlue
CloudStack Managed User Data and Demo - Harikrishna Patnala - ShapeBlue
ShapeBlue68 views
Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ... by ShapeBlue
Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ...Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ...
Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ...
ShapeBlue52 views
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue by ShapeBlue
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlueVNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue
ShapeBlue134 views
Business Analyst Series 2023 - Week 4 Session 7 by DianaGray10
Business Analyst Series 2023 -  Week 4 Session 7Business Analyst Series 2023 -  Week 4 Session 7
Business Analyst Series 2023 - Week 4 Session 7
DianaGray10110 views
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive by Network Automation Forum
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLiveAutomating a World-Class Technology Conference; Behind the Scenes of CiscoLive
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive
KVM Security Groups Under the Hood - Wido den Hollander - Your.Online by ShapeBlue
KVM Security Groups Under the Hood - Wido den Hollander - Your.OnlineKVM Security Groups Under the Hood - Wido den Hollander - Your.Online
KVM Security Groups Under the Hood - Wido den Hollander - Your.Online
ShapeBlue154 views
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit... by ShapeBlue
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...
ShapeBlue86 views
"Surviving highload with Node.js", Andrii Shumada by Fwdays
"Surviving highload with Node.js", Andrii Shumada "Surviving highload with Node.js", Andrii Shumada
"Surviving highload with Node.js", Andrii Shumada
Fwdays49 views
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue by ShapeBlue
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue
ShapeBlue75 views
CloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&T by ShapeBlue
CloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&TCloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&T
CloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&T
ShapeBlue81 views
Confidence in CloudStack - Aron Wagner, Nathan Gleason - Americ by ShapeBlue
Confidence in CloudStack - Aron Wagner, Nathan Gleason - AmericConfidence in CloudStack - Aron Wagner, Nathan Gleason - Americ
Confidence in CloudStack - Aron Wagner, Nathan Gleason - Americ
ShapeBlue58 views
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT by ShapeBlue
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBITUpdates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT
ShapeBlue138 views
Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O... by ShapeBlue
Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O...Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O...
Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O...
ShapeBlue59 views
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue by ShapeBlue
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlueMigrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue
ShapeBlue147 views
Extending KVM Host HA for Non-NFS Storage - Alex Ivanov - StorPool by ShapeBlue
Extending KVM Host HA for Non-NFS Storage -  Alex Ivanov - StorPoolExtending KVM Host HA for Non-NFS Storage -  Alex Ivanov - StorPool
Extending KVM Host HA for Non-NFS Storage - Alex Ivanov - StorPool
ShapeBlue56 views

dotMemory 4 - What's inside?

  • 1. dotMemory 4 what's inside Maarten Balliauw Technical Evangelist maarten.balliauw@jetbrains.com @maartenballiauw
  • 2. Who am I? Maarten Balliauw Belgium (Antwerp) Technical Evangelist, JetBrains Focus on web ASP.NET MVC, Windows Azure, ... PHP, ... Big passion: Cloud (Windows Azure) Home brewer http://blog.maartenballiauw.be @maartenballiauw
  • 3. Have a question? Use the Question Pane. We’ll try and answer as we go along
  • 5. Agenda Why use a tool like dotMemory? What happened to dotTrace Memory? .NET Memory Management 101 Exploring dotMemory UI concepts Finding a memory leak Analyzing memory traffic
  • 6. Why use a tool like dotMemory? .NET creates numerous objects in memory, even for simple programs Memory is constantly being assigned and released (memory traffic) What if some memory is retained while we expected it to be released?
  • 7. Why use a tool like dotMemory? dotMemory tries to answer: Why is this object still in memory? What causes the memory leak? What takes so much memory? How much memory traffic is going on? Are there any memory allocation/distribution patterns violated? E.g. event handlers not being unregistered, sparse arrays, … Don’t just use it when things go wrong!
  • 8. What does dotMemory do for me? Collect memory snapshot information Info about all objects on the managed heap at the moment a snapshot is taken Collect memory traffic information How much memory is allocated / released Analyze these during a profiling session
  • 9. What happened to dotTrace Memory? Did you even know we had a memory profiler before? dotTrace Memory 3.5 Hasn’t had any significant updates since 2010 Complex to work with Time for a fresh memory profiler: dotMemory 4! Friendly – new UI displays complex information in an easy way Powerful – works on very large programs (we use it on R#)
  • 10. .NET Memory Management 101 Memory Allocation .NET runtime reserves region of address space for every new process managed heap Objects are allocated in the heap Allocating memory is fast, it’s just adding a pointer Some unmanaged memory is also consumed (not GC-ed) .NET CLR, Dynamic libraries, Graphics buffer, … Memory Release or “Garbage Collection” (GC) Generations Large Object Heap See http://confluence.jetbrains.com/display/NETCOM/What+You+Should+Know+about+.NET+Memory+Management
  • 11. .NET Memory Management 101 Memory Allocation Memory Release or “Garbage Collection” (GC) GC releases objects no longer in use by examining application roots GC builds a graph that contains all the objects that are reachable from these roots. Object unreachable? GC removes the object from the heap, releasing memory After the object is removed, GC compacts reachable objects in memory. Generations Large Object Heap See http://confluence.jetbrains.com/display/NETCOM/What+You+Should+Know+about+.NET+Memory+Management
  • 12. .NET Memory Management 101 Memory Allocation Memory Release or “Garbage Collection” (GC) Generations Managed heap divided in segments: generation 0, 1 and 2 New objects go into Gen 0 Gen 0 full? Perform GC and promote all reachable objects to Gen 1. This is typically pretty fast. Gen 1 full? Perform GC on Gen 1 and Gen 0. Promote all reachable objects to Gen 2. Gen 2 full? Perform full GC (2, 1, 0). If not enough memory for new allocations, throws OutOfMemoryException Full GC has performance impact since all objects in managed heap are verified. Large Object Heap See http://confluence.jetbrains.com/display/NETCOM/What+You+Should+Know+about+.NET+Memory+Management
  • 13. .NET Memory Management 101 Memory Allocation Memory Release or “Garbage Collection” (GC) Generations Generation 0 Generation 1 Generation 2 Short-lived objects (e.g. Local variables) In-between objects Long-lived objects (e.g. App’s main form) Large Object Heap See http://confluence.jetbrains.com/display/NETCOM/What+You+Should+Know+about+.NET+Memory+Management
  • 14. .NET Memory Management 101 Memory Allocation Memory Release or “Garbage Collection” (GC) Generations Large Object Heap Large objects (>85KB) stored in separate segment of managed heap: Large Object Heap (LOH) Objects in LOH collected only during full garbage collection Survived objects in LOH are not compacted (by default). This means that LOH becomes fragmented over time. Fragmentation can cause OutOfMemoryException See http://confluence.jetbrains.com/display/NETCOM/What+You+Should+Know+about+.NET+Memory+Management
  • 15. A look at dotMemory 4 demo Exploring the UI
  • 17. Let’s see if we can find what’s wrong! demo Investigating a memory leak
  • 18. What just happened? public AdWindow(Window owner) { // ... DispatcherTimer[] // Run the timer that changes the ad's image adTimer = new DispatcherTimer(); adTimer.Interval = TimeSpan.FromSeconds(3); adTimer.Tick += ChangeAds; adTimer.Start(); DispatcherTimer .Tick AdWindow } adTimer.Tick -= ChangeAds;
  • 19. How is the GC affecting our application? demo Analyzing memory traffic
  • 20. What just happened? for (int i = 0; i < .... StringReverse r StringReverse r StringReverse r
  • 21. Why use a tool like dotMemory? Why is this object still in memory? What takes so much memory? How much memory traffic is going on? Are there any memory allocation/distribution patterns violated?
  • 23. Resources Try dotMemory 4 now! http://confluence.jetbrains.com/display/NetProf/dotMemory+4.0+EAP Give us feedback! Tutorials dotMemory Manual http://bit.ly/dotmemory-manual Getting started http://bit.ly/dotmemory-gettingstarted Finding memory leaks http://bit.ly/dotmemory-findingmemleak Analyzing memory traffic http://bit.ly/dotmemory-memorytraffic
  • 25. Thank you for joining us! Want to learn more? Follow @dottrace on Twitter to learn product tips and register for upcoming webinars