SlideShare uma empresa Scribd logo
1 de 17
Baixar para ler offline
Eclipse Memory Analyzer
Krasimir Semerdzhiev
Development Architect / SAP Labs Bulgaria
Agenda


Getting started
Get hands dirty
Q&A




© 2011 SAP AG. All rights reserved.   2
Getting started
Few assumptions


You’ve passed beyond “Hello World” in Java
Hello World apps tend not to require too much memory




You’ve gotten an OutOfMemoryError at least once in your life :)




You’re proficient already with Garbage Collection
Attended the previous BGOUG event GC session




© 2011 SAP AG. All rights reserved.                               3
Getting started
Memory analyzer basics


Works with heap dumps – live snapshots of:




© 2011 SAP AG. All rights reserved.          4
Getting started
How to get a heap dump


Non-Interactive
-XX:+HeapDumpOnOutOfMemoryError


On Demand
JDK1.4.2_12+ and -XX:+HeapDumpOnCtrlBreak
JDK6 and JConsole or VisualVM


On IBM VMs
     -Xdump:system:events=throw,filter=java/lang/OutOfMemoryError,
    request=exclusive+prepwalk


More…
http://wiki.eclipse.org/index.php/MemoryAnalyzer#Getting_a_Heap_Dump




© 2011 SAP AG. All rights reserved.                                    5
Getting started
Shallow vs. Retained heap


Shallow heap is the memory consumed by one object
Retained set of X is the set of objects that will be garbage collected if X is garbage
collected
Retained heap of X is the sum of shallow sizes of all objects in the retained set of
X, i.e. memory kept alive by X

                                       Set of elements    Retained Set
                                       C                  C, F, G, J
                                       K                  K
                                       C, K               C, F, G, J, K, I




© 2011 SAP AG. All rights reserved.                                                  6
Getting started
Dominator tree


An object x dominates an object y if every path in the object graph from the start (or the root)
 node to y must go through x.

In the dominator tree each object is the immediate dominator of its children, so
  dependencies between the objects are easily identified.




© 2011 SAP AG. All rights reserved.                                                           7
Getting started
Dominator tree




© 2011 SAP AG. All rights reserved.   8
Getting started
Java references – java.lang.ref
                                                                         Softly reachable


    Created                           Initialized   Strongly reachable                         Finalized

                                                                         Weakly reachable


Soft reference
                                                                                            Phantom reachable
GC will try to preserve the object
Will collect it prior to throwing OutOfMemoryError



Weak reference
GC is free to reclaim the object.


Phantom reference
Track object collections


© 2011 SAP AG. All rights reserved.                                                                             9
Getting started
GC roots in Java


Keeps the objects in heap from being collected by GC

    System Class                       Finalizer Queue    GC handle      Unknown

    JNI Local                           Unfinalized      Thread stack   Unreachable

   JNI Global                   Thread block    Thread   Busy Monitor




© 2011 SAP AG. All rights reserved.                                                   10
Getting started
What is a leak?




© 2011 SAP AG. All rights reserved.   11
Agenda


Getting started
Get hands dirty
Q&A




© 2011 SAP AG. All rights reserved.   12
Analyze memory consumption
Getting the heap dump: Setup


JConsole refuses to connect




© 2011 SAP AG. All rights reserved.   13
Analyze memory consumption



DEMO




© 2011 SAP AG. All rights reserved.   14
How to get involved?


Eclipse Home Page
        http://www.eclipse.org/mat/

Forum
                 eclipse.technology.memory-analyzer

Blog
                 http://dev.eclipse.org/blogs/memoryanalyzer




© 2011 SAP AG. All rights reserved.                            15
Questions?



Krasimir Semerdzhiev
krasimir.semerdzhiev@sap.com
Thank You!



Krasimir Semerdzhiev
krasimir.semerdzhiev@sap.com

Mais conteúdo relacionado

Semelhante a [BGOUG] Memory analyzer

A path to modularity with Eclipse Virgo
A path to modularity with Eclipse VirgoA path to modularity with Eclipse Virgo
A path to modularity with Eclipse Virgo
katya_todorova
 
Gemini WEB and Virgo
Gemini WEB and VirgoGemini WEB and Virgo
Gemini WEB and Virgo
Hristo Iliev
 
OSGi in Java EE Servers - Sneak Peek Under the Hood - Krasimir Semerdzhiev
OSGi in Java EE Servers - Sneak Peek Under the Hood - Krasimir SemerdzhievOSGi in Java EE Servers - Sneak Peek Under the Hood - Krasimir Semerdzhiev
OSGi in Java EE Servers - Sneak Peek Under the Hood - Krasimir Semerdzhiev
mfrancis
 

Semelhante a [BGOUG] Memory analyzer (20)

JVM: A Platform for Multiple Languages
JVM: A Platform for Multiple LanguagesJVM: A Platform for Multiple Languages
JVM: A Platform for Multiple Languages
 
A path to modularity with Eclipse Virgo
A path to modularity with Eclipse VirgoA path to modularity with Eclipse Virgo
A path to modularity with Eclipse Virgo
 
In The Future We All Use Symfony2
In The Future We All Use Symfony2In The Future We All Use Symfony2
In The Future We All Use Symfony2
 
The Right Pill for JRuby Memory and Thread Issues: Eclipse Memory Analyzer
The Right Pill for JRuby Memory and Thread Issues: Eclipse Memory AnalyzerThe Right Pill for JRuby Memory and Thread Issues: Eclipse Memory Analyzer
The Right Pill for JRuby Memory and Thread Issues: Eclipse Memory Analyzer
 
Gemini WEB and Virgo
Gemini WEB and VirgoGemini WEB and Virgo
Gemini WEB and Virgo
 
Java notes | All Basics |
Java notes | All Basics |Java notes | All Basics |
Java notes | All Basics |
 
Java 7: Fork/Join, Invokedynamic and the future
Java 7: Fork/Join, Invokedynamic and the futureJava 7: Fork/Join, Invokedynamic and the future
Java 7: Fork/Join, Invokedynamic and the future
 
Java: Rumours of my demise are greatly exaggerated
Java: Rumours of my demise are greatly exaggeratedJava: Rumours of my demise are greatly exaggerated
Java: Rumours of my demise are greatly exaggerated
 
OSGi in Java EE Servers - Sneak Peek Under the Hood - Krasimir Semerdzhiev
OSGi in Java EE Servers - Sneak Peek Under the Hood - Krasimir SemerdzhievOSGi in Java EE Servers - Sneak Peek Under the Hood - Krasimir Semerdzhiev
OSGi in Java EE Servers - Sneak Peek Under the Hood - Krasimir Semerdzhiev
 
IBM Java PackedObjects
IBM Java PackedObjectsIBM Java PackedObjects
IBM Java PackedObjects
 
JavaOne2015-What's in an Object?
JavaOne2015-What's in an Object?JavaOne2015-What's in an Object?
JavaOne2015-What's in an Object?
 
#JavaOne What's in an object?
#JavaOne What's in an object?#JavaOne What's in an object?
#JavaOne What's in an object?
 
Efficient Memory and Thread Management in Highly Parallel Java Applications
Efficient Memory and Thread Management in Highly Parallel Java ApplicationsEfficient Memory and Thread Management in Highly Parallel Java Applications
Efficient Memory and Thread Management in Highly Parallel Java Applications
 
1 .java basic
1 .java basic1 .java basic
1 .java basic
 
55j7
55j755j7
55j7
 
JavaYDL18
JavaYDL18JavaYDL18
JavaYDL18
 
A quick view about Java Virtual Machine
A quick view about Java Virtual MachineA quick view about Java Virtual Machine
A quick view about Java Virtual Machine
 
Avro - More Than Just a Serialization Framework - CHUG - 20120416
Avro - More Than Just a Serialization Framework - CHUG - 20120416Avro - More Than Just a Serialization Framework - CHUG - 20120416
Avro - More Than Just a Serialization Framework - CHUG - 20120416
 
The Forces Driving Java
The Forces Driving JavaThe Forces Driving Java
The Forces Driving Java
 
Building Large Java Projects Faster: Multicore javac and Makefile integration
Building Large Java Projects Faster: Multicore javac and Makefile integrationBuilding Large Java Projects Faster: Multicore javac and Makefile integration
Building Large Java Projects Faster: Multicore javac and Makefile integration
 

Mais de SAP HANA Cloud Platform

Mais de SAP HANA Cloud Platform (14)

SAP Hack2Build hackathon - SAP Commerce Cloud & Kyma runtime
SAP Hack2Build hackathon - SAP Commerce Cloud & Kyma runtimeSAP Hack2Build hackathon - SAP Commerce Cloud & Kyma runtime
SAP Hack2Build hackathon - SAP Commerce Cloud & Kyma runtime
 
Gardener: Managed Kubernetes on Your Terms
Gardener: Managed Kubernetes on Your TermsGardener: Managed Kubernetes on Your Terms
Gardener: Managed Kubernetes on Your Terms
 
Kyma: Extending Business systems with Kubernetes, Istio and <fill the blank>.
Kyma: Extending Business systems with Kubernetes, Istio and <fill the blank>.Kyma: Extending Business systems with Kubernetes, Istio and <fill the blank>.
Kyma: Extending Business systems with Kubernetes, Istio and <fill the blank>.
 
Using Kubernetes to Extend Enterprise Software
Using Kubernetes to Extend Enterprise Software Using Kubernetes to Extend Enterprise Software
Using Kubernetes to Extend Enterprise Software
 
Kubernetes, Istio and Knative - noteworthy practical experience
Kubernetes, Istio and Knative - noteworthy practical experienceKubernetes, Istio and Knative - noteworthy practical experience
Kubernetes, Istio and Knative - noteworthy practical experience
 
Options for running Kubernetes at scale across multiple cloud providers
Options for running Kubernetes at scale across multiple cloud providersOptions for running Kubernetes at scale across multiple cloud providers
Options for running Kubernetes at scale across multiple cloud providers
 
SAP DKOM 2016 | 30154 | SAP HCP Cloud Extensions Intro
SAP DKOM 2016 | 30154 | SAP HCP Cloud Extensions IntroSAP DKOM 2016 | 30154 | SAP HCP Cloud Extensions Intro
SAP DKOM 2016 | 30154 | SAP HCP Cloud Extensions Intro
 
SAP TechEd 2015 | DEV109 | Extending Cloud Solutions from SAP using SAP HANA ...
SAP TechEd 2015 | DEV109 | Extending Cloud Solutions from SAP using SAP HANA ...SAP TechEd 2015 | DEV109 | Extending Cloud Solutions from SAP using SAP HANA ...
SAP TechEd 2015 | DEV109 | Extending Cloud Solutions from SAP using SAP HANA ...
 
SAP D-Code/TechEd 2014|DEV203|Extending SuccessFactors using SAP HANA Cloud P...
SAP D-Code/TechEd 2014|DEV203|Extending SuccessFactors using SAP HANA Cloud P...SAP D-Code/TechEd 2014|DEV203|Extending SuccessFactors using SAP HANA Cloud P...
SAP D-Code/TechEd 2014|DEV203|Extending SuccessFactors using SAP HANA Cloud P...
 
SAP TechEd 2013: CD105: Extending SuccessFactors EmployeeCentral with apps on...
SAP TechEd 2013: CD105: Extending SuccessFactors EmployeeCentral with apps on...SAP TechEd 2013: CD105: Extending SuccessFactors EmployeeCentral with apps on...
SAP TechEd 2013: CD105: Extending SuccessFactors EmployeeCentral with apps on...
 
SAP HANA Cloud Platform Community BOF @ Devoxx 2013
SAP HANA Cloud Platform Community BOF @ Devoxx 2013SAP HANA Cloud Platform Community BOF @ Devoxx 2013
SAP HANA Cloud Platform Community BOF @ Devoxx 2013
 
SAP HANA Cloud: From Your Datacenter to the Cloud and Back
SAP HANA Cloud: From Your Datacenter to the Cloud and Back  SAP HANA Cloud: From Your Datacenter to the Cloud and Back
SAP HANA Cloud: From Your Datacenter to the Cloud and Back
 
[BGOUG] Java GC - Friend or Foe
[BGOUG] Java GC - Friend or Foe[BGOUG] Java GC - Friend or Foe
[BGOUG] Java GC - Friend or Foe
 
Eclipse Open Source @ SAP
Eclipse Open Source @ SAPEclipse Open Source @ SAP
Eclipse Open Source @ SAP
 

Último

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Último (20)

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 

[BGOUG] Memory analyzer

  • 1. Eclipse Memory Analyzer Krasimir Semerdzhiev Development Architect / SAP Labs Bulgaria
  • 2. Agenda Getting started Get hands dirty Q&A © 2011 SAP AG. All rights reserved. 2
  • 3. Getting started Few assumptions You’ve passed beyond “Hello World” in Java Hello World apps tend not to require too much memory You’ve gotten an OutOfMemoryError at least once in your life :) You’re proficient already with Garbage Collection Attended the previous BGOUG event GC session © 2011 SAP AG. All rights reserved. 3
  • 4. Getting started Memory analyzer basics Works with heap dumps – live snapshots of: © 2011 SAP AG. All rights reserved. 4
  • 5. Getting started How to get a heap dump Non-Interactive -XX:+HeapDumpOnOutOfMemoryError On Demand JDK1.4.2_12+ and -XX:+HeapDumpOnCtrlBreak JDK6 and JConsole or VisualVM On IBM VMs -Xdump:system:events=throw,filter=java/lang/OutOfMemoryError, request=exclusive+prepwalk More… http://wiki.eclipse.org/index.php/MemoryAnalyzer#Getting_a_Heap_Dump © 2011 SAP AG. All rights reserved. 5
  • 6. Getting started Shallow vs. Retained heap Shallow heap is the memory consumed by one object Retained set of X is the set of objects that will be garbage collected if X is garbage collected Retained heap of X is the sum of shallow sizes of all objects in the retained set of X, i.e. memory kept alive by X Set of elements Retained Set C C, F, G, J K K C, K C, F, G, J, K, I © 2011 SAP AG. All rights reserved. 6
  • 7. Getting started Dominator tree An object x dominates an object y if every path in the object graph from the start (or the root) node to y must go through x. In the dominator tree each object is the immediate dominator of its children, so dependencies between the objects are easily identified. © 2011 SAP AG. All rights reserved. 7
  • 8. Getting started Dominator tree © 2011 SAP AG. All rights reserved. 8
  • 9. Getting started Java references – java.lang.ref Softly reachable Created Initialized Strongly reachable Finalized Weakly reachable Soft reference Phantom reachable GC will try to preserve the object Will collect it prior to throwing OutOfMemoryError Weak reference GC is free to reclaim the object. Phantom reference Track object collections © 2011 SAP AG. All rights reserved. 9
  • 10. Getting started GC roots in Java Keeps the objects in heap from being collected by GC System Class Finalizer Queue GC handle Unknown JNI Local Unfinalized Thread stack Unreachable JNI Global Thread block Thread Busy Monitor © 2011 SAP AG. All rights reserved. 10
  • 11. Getting started What is a leak? © 2011 SAP AG. All rights reserved. 11
  • 12. Agenda Getting started Get hands dirty Q&A © 2011 SAP AG. All rights reserved. 12
  • 13. Analyze memory consumption Getting the heap dump: Setup JConsole refuses to connect © 2011 SAP AG. All rights reserved. 13
  • 14. Analyze memory consumption DEMO © 2011 SAP AG. All rights reserved. 14
  • 15. How to get involved? Eclipse Home Page http://www.eclipse.org/mat/ Forum eclipse.technology.memory-analyzer Blog http://dev.eclipse.org/blogs/memoryanalyzer © 2011 SAP AG. All rights reserved. 15