SlideShare une entreprise Scribd logo
1  sur  17
Télécharger pour lire hors ligne
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

Contenu connexe

Similaire à [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
 

Similaire à [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
 

Plus de SAP HANA Cloud Platform

Plus 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
 

Dernier

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Dernier (20)

Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
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...
 
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
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 

[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