SlideShare a Scribd company logo
Vladimir Pavlov Dimitar Giormov SAP Labs Bulgaria Using and Extending Memory Analyzer into Uncharted Waters Memory Analyzer
Introduction The Headaches Eclipse Memory Analyzer Extending Eclipse Memory Analyzer API and Extension Points JRuby Case Android Apps Case Q & A © SAP 2010 / Page
Memory leaks Hard to debug and find the root cause Eventually lead to OOM errors    Brings your system down    Often not reproducible Thread issues Deadlocks Exhausted threads Waiting for an external resource – e.g. DB connection    Application does not respond    Whole system hangs THE HEADACHES © SAP 2010 / Page
Eclipse Memory Analyzer  (MAT) is… Java heap analyzer Helps find memory leaks and reduce memory consumption UI and programmatic access to data in the heap dumps Multi-Gigabyte Java Heap Dumps Are Nothing to Fear Now Soooo much faster than other tools, e.g. jhat Very little memory “overhead” for processing heap dumps (again – cf. jhat) Supports Sun, SAP, HP, IBM JDKs 1.4.2 and above Automatic problem recognition Could also process thread dumps and correlate data to provide additional details Initial contribution from SAP, joined by IBM Highly extensible ECLIPSE MEMORY ANALYZER © SAP 2010 / Page  Memory Analyzer
 
Why extend MAT? To save time doing the same thing repeatedly To help others use the same technique as you To do things not possible from the GUI To build in application or domain specific logic How to extend MAT? MAT provides a set of Eclipse extension points User writes an extension plug-in MAT provides an API for reading data from a heap dump EXTENDING MAT © SAP 2010 / Page
Isnapshot Represents a heap dump Methods for reading classes and objects, getting sizes, GC roots, referenced objects, etc. Object model IClass IObject IInstance IClassLoader IArray IPrimitiveArray IObjectArray PROGRAMMATIC ACCESS TO A SNAPSHOT © SAP 2010 / Page
Name Resolver Used to give meaningful descriptions of objects Similar to a toString() method Extension point:  org.eclipse.mat.api.nameResolver Query Used for exploring dumps or detailed analysis Result in the form of a table, tree, histogram, pie chart, free text... Integrated into MAT’s menus “ Collaboration” of queries Extension point:  org.eclipse.mat.report.query Request Resolver Used to provide details about what a thread was doing Contributes to Leak Suspects report Extension point:  org.eclipse.mat.api.requestResolver EXTENSION POINTS © SAP 2010 / Page
Parser – for new heap dump types and VMs, such as for Jikes RVM Trigger Heap Dump – org.eclipse.mat.api.heapDumpProvider For new VM types Reports – org.eclipse.mat.report.report HTML results of queries – also used for batch mode Thread Resolver – additional thread data such as native stacks Ticket Resolver – can identify appropriate routing for problems Based on classes and class loaders of problematic objects Rendering – org.eclipse.mat.api.renderer Additional to HTML and CSV Annotations used as filters and for configuration EXTENSION POINTS (CONTD.) © SAP 2010 / Page
Ruby  is… Dynamic  scripting language Object-oriented Focus on simplicity and productivity Elegant syntax, natural to read and easy to write JRuby  is… 100% Java implementation of the Ruby programming language Interpreter running atop the JVM Generating Java bytecode (JIT compilation mode) Tight integration with Java RUBY AND JRUBY © SAP 2010 / Page
Adding JRuby into the picture… THE HEADACHES – AGGRAVATED © SAP 2010 / Page
 
What were the goals Identify memory leaks (critical when talking about embedded systems due to hardware restrictions) Filter memory usage by classes belonging to the users’ application Simpler workflow: developers start analyzing by classes they already know (not Android system classes) Why MAT was chosen The MAT perspective provides views to analyze application status, identify leaks, and so on, given an  HPROF  file Reports are easy to navigate and provide information about retained heap It is Eclipse based Android supports the creation and extraction of  HPROF  files MAT INTEGRATION WITH MOTODEV STUDIO
Implemented an Extension Extension point used:  org.eclipse.mat.ui Added a new page extending  CompositeHeapEditorPane Created  MotodevPane  based on  OQLPane class WORK DONE ON MAT
The integration of MOTODEV Studio, Google DDMS and Eclipse MAT worked very well. Used the  org.eclipse.mat.ui  extension point, which was well-documented. It took about 2 weeks of one developer to study the project, implement and test the solution. OVERALL EXPERIENCE
Eclipse Memory Analyzer provides: Powerful and efficient  memory analysis features out-of-the-box API for extracting data from a heap dump Application or domain specific analysis can be added as extensions SUMMARY © SAP 2010 / Page
RESOURCES © SAP 2010 / Page
THANK YOU! in:  vpavlov t:  @giormov Memory Analyzer

More Related Content

PPTX
Functions with Heap and stack
PDF
Scalable Automatic Machine Learning in H2O
PPT
The Right Pill for JRuby Memory and Thread Issues: Eclipse Memory Analyzer
PPTX
Debugging and Profiling Cloud Apps? Sure, You Can Do It Now!
PDF
SAP HANA Cloud Platform CodeJam
PPTX
SAP HANA Cloud Platform CodeJam 2015
PPT
Distilling Dumps: a Guide to Using and Extending Memory Analyzer
PPT
Eclipse Memory Analyzer
Functions with Heap and stack
Scalable Automatic Machine Learning in H2O
The Right Pill for JRuby Memory and Thread Issues: Eclipse Memory Analyzer
Debugging and Profiling Cloud Apps? Sure, You Can Do It Now!
SAP HANA Cloud Platform CodeJam
SAP HANA Cloud Platform CodeJam 2015
Distilling Dumps: a Guide to Using and Extending Memory Analyzer
Eclipse Memory Analyzer

Similar to Using and Extending Memory Analyzer into Uncharted Waters (20)

PDF
Tuning Android Applications (Part One)
PPT
Eclipse Memory Analyzer - More Than Just a Heap Walker
PPTX
EclipseMAT
PDF
Debugging Java from Dumps
PDF
Web Sphere Problem Determination Ext
PPTX
Exploring Java Heap Dumps (Oracle Code One 2018)
PPTX
Detecting Memory Leaks in Android App
PPTX
Memory Analyzer Tool (MAT)
PPT
Javaforum looking into the memory
PPT
Practical lessons in memory analysis
PDF
Hp java heap dump analysis Workshop
PDF
Ps ts 4118-304118_230-1_fin_v1
PDF
Take advantage of memory analyzer tool inside your continuous integration
PDF
Take advantage of memory analyzer tool inside your continuous integration
PDF
Memory Analysis of the Dalvik (Android) Virtual Machine
PDF
TechGIG_Memory leaks in_java_webnair_26th_july_2012
PDF
Memory management for_android_apps
PDF
Eclipse Memory Analyzer Tool
PDF
[BGOUG] Memory analyzer
PPTX
Heap Dump Analysis - AEM: Real World Issues
Tuning Android Applications (Part One)
Eclipse Memory Analyzer - More Than Just a Heap Walker
EclipseMAT
Debugging Java from Dumps
Web Sphere Problem Determination Ext
Exploring Java Heap Dumps (Oracle Code One 2018)
Detecting Memory Leaks in Android App
Memory Analyzer Tool (MAT)
Javaforum looking into the memory
Practical lessons in memory analysis
Hp java heap dump analysis Workshop
Ps ts 4118-304118_230-1_fin_v1
Take advantage of memory analyzer tool inside your continuous integration
Take advantage of memory analyzer tool inside your continuous integration
Memory Analysis of the Dalvik (Android) Virtual Machine
TechGIG_Memory leaks in_java_webnair_26th_july_2012
Memory management for_android_apps
Eclipse Memory Analyzer Tool
[BGOUG] Memory analyzer
Heap Dump Analysis - AEM: Real World Issues
Ad

Recently uploaded (20)

PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Approach and Philosophy of On baking technology
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPT
Teaching material agriculture food technology
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Encapsulation theory and applications.pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Machine learning based COVID-19 study performance prediction
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Diabetes mellitus diagnosis method based random forest with bat algorithm
Network Security Unit 5.pdf for BCA BBA.
Approach and Philosophy of On baking technology
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Teaching material agriculture food technology
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Review of recent advances in non-invasive hemoglobin estimation
MYSQL Presentation for SQL database connectivity
Spectral efficient network and resource selection model in 5G networks
The Rise and Fall of 3GPP – Time for a Sabbatical?
Advanced methodologies resolving dimensionality complications for autism neur...
Encapsulation theory and applications.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
NewMind AI Weekly Chronicles - August'25-Week II
Programs and apps: productivity, graphics, security and other tools
Chapter 3 Spatial Domain Image Processing.pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
20250228 LYD VKU AI Blended-Learning.pptx
Machine learning based COVID-19 study performance prediction
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Ad

Using and Extending Memory Analyzer into Uncharted Waters

  • 1. Vladimir Pavlov Dimitar Giormov SAP Labs Bulgaria Using and Extending Memory Analyzer into Uncharted Waters Memory Analyzer
  • 2. Introduction The Headaches Eclipse Memory Analyzer Extending Eclipse Memory Analyzer API and Extension Points JRuby Case Android Apps Case Q & A © SAP 2010 / Page
  • 3. Memory leaks Hard to debug and find the root cause Eventually lead to OOM errors  Brings your system down  Often not reproducible Thread issues Deadlocks Exhausted threads Waiting for an external resource – e.g. DB connection  Application does not respond  Whole system hangs THE HEADACHES © SAP 2010 / Page
  • 4. Eclipse Memory Analyzer (MAT) is… Java heap analyzer Helps find memory leaks and reduce memory consumption UI and programmatic access to data in the heap dumps Multi-Gigabyte Java Heap Dumps Are Nothing to Fear Now Soooo much faster than other tools, e.g. jhat Very little memory “overhead” for processing heap dumps (again – cf. jhat) Supports Sun, SAP, HP, IBM JDKs 1.4.2 and above Automatic problem recognition Could also process thread dumps and correlate data to provide additional details Initial contribution from SAP, joined by IBM Highly extensible ECLIPSE MEMORY ANALYZER © SAP 2010 / Page Memory Analyzer
  • 5.  
  • 6. Why extend MAT? To save time doing the same thing repeatedly To help others use the same technique as you To do things not possible from the GUI To build in application or domain specific logic How to extend MAT? MAT provides a set of Eclipse extension points User writes an extension plug-in MAT provides an API for reading data from a heap dump EXTENDING MAT © SAP 2010 / Page
  • 7. Isnapshot Represents a heap dump Methods for reading classes and objects, getting sizes, GC roots, referenced objects, etc. Object model IClass IObject IInstance IClassLoader IArray IPrimitiveArray IObjectArray PROGRAMMATIC ACCESS TO A SNAPSHOT © SAP 2010 / Page
  • 8. Name Resolver Used to give meaningful descriptions of objects Similar to a toString() method Extension point: org.eclipse.mat.api.nameResolver Query Used for exploring dumps or detailed analysis Result in the form of a table, tree, histogram, pie chart, free text... Integrated into MAT’s menus “ Collaboration” of queries Extension point: org.eclipse.mat.report.query Request Resolver Used to provide details about what a thread was doing Contributes to Leak Suspects report Extension point: org.eclipse.mat.api.requestResolver EXTENSION POINTS © SAP 2010 / Page
  • 9. Parser – for new heap dump types and VMs, such as for Jikes RVM Trigger Heap Dump – org.eclipse.mat.api.heapDumpProvider For new VM types Reports – org.eclipse.mat.report.report HTML results of queries – also used for batch mode Thread Resolver – additional thread data such as native stacks Ticket Resolver – can identify appropriate routing for problems Based on classes and class loaders of problematic objects Rendering – org.eclipse.mat.api.renderer Additional to HTML and CSV Annotations used as filters and for configuration EXTENSION POINTS (CONTD.) © SAP 2010 / Page
  • 10. Ruby is… Dynamic scripting language Object-oriented Focus on simplicity and productivity Elegant syntax, natural to read and easy to write JRuby is… 100% Java implementation of the Ruby programming language Interpreter running atop the JVM Generating Java bytecode (JIT compilation mode) Tight integration with Java RUBY AND JRUBY © SAP 2010 / Page
  • 11. Adding JRuby into the picture… THE HEADACHES – AGGRAVATED © SAP 2010 / Page
  • 12.  
  • 13. What were the goals Identify memory leaks (critical when talking about embedded systems due to hardware restrictions) Filter memory usage by classes belonging to the users’ application Simpler workflow: developers start analyzing by classes they already know (not Android system classes) Why MAT was chosen The MAT perspective provides views to analyze application status, identify leaks, and so on, given an HPROF file Reports are easy to navigate and provide information about retained heap It is Eclipse based Android supports the creation and extraction of HPROF files MAT INTEGRATION WITH MOTODEV STUDIO
  • 14. Implemented an Extension Extension point used: org.eclipse.mat.ui Added a new page extending CompositeHeapEditorPane Created MotodevPane based on OQLPane class WORK DONE ON MAT
  • 15. The integration of MOTODEV Studio, Google DDMS and Eclipse MAT worked very well. Used the org.eclipse.mat.ui extension point, which was well-documented. It took about 2 weeks of one developer to study the project, implement and test the solution. OVERALL EXPERIENCE
  • 16. Eclipse Memory Analyzer provides: Powerful and efficient memory analysis features out-of-the-box API for extracting data from a heap dump Application or domain specific analysis can be added as extensions SUMMARY © SAP 2010 / Page
  • 17. RESOURCES © SAP 2010 / Page
  • 18. THANK YOU! in: vpavlov t: @giormov Memory Analyzer

Editor's Notes

  • #14: Hprof is the file that MAT plugins are able to load and display memory reports Retained heap is the memory kept alive by a class X
  • #15: CompositeHeapEditorPane is the base class for the pages inside MAT report OQLPane is a page that shows memory usage and have an edit field to filter classes in the report using a syntax similar to SQL (called OQL – object query language) MotodevPane (see picture) generates the filter selecting the Android application package (e.g.: the statement with “com.a.*” for the user).
  • #16: It would be interesting to mention that in the 2-week time, we also p rovided methods to pull MAT files from phone/emulator integrated into our Device Manager view