Eclipse Summit Europe 2010 presentation: "Distilling Dumps: a Guide to Using and Extending Memory Analyzer"
Using Eclipse Memory Analyzer we shall show how to find out what your application was doing when a failure happened, what its data structures looked like, where memory was consumed and who owned it, and why the problem occurred, all based on one heap dump.
We shall also explain how the tool can be enhanced (using its defined API and extension points) for your particular environment to go beyond debugging out of memory errors.
Andrew Johnson
Krum Tsvetkov
Distilling Dumps: a Guide to Using and Extending Memory Analyzer
1. Distilling Heap Dumps:
a Guide to Using and Extending
Memory Analyzer
Krum Tsvetkov (SAP)
Andrew Johnson (IBM)
2. Distilling Heap Dumps: a Guide to
Using and Extending Memory
Analyzer
Krum Tsvetkov, Andrew Johnson 2
Memory Analyzer overview
Works with heap dumps – post-mortem analysis
UI and programmatic access to data in the heap dumps
Automatic problem recognition
Extendable
3. Distilling Heap Dumps: a Guide to
Using and Extending Memory
Analyzer
Krum Tsvetkov, Andrew Johnson 3
Demo
Introduction to Memory Analyzer
4. Distilling Heap Dumps: a Guide to
Using and Extending Memory
Analyzer
Krum Tsvetkov, Andrew Johnson 4
Introduction to extending MAT
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 specific logic
Examples
Eclipse bundle explorer – shown as a tree (provided with MAT)
JRuby (recent contribution to MAT)
How to extend MAT
MAT provides a set of Eclipse extension points
User writes an extension plug-in
MAT provides an API for reading the data from a dump
5. Distilling Heap Dumps: a Guide to
Using and Extending Memory
Analyzer
Krum Tsvetkov, Andrew Johnson 6
Name Resolver
Used to give meaningful descriptions of objects
Text result (similar to a toString())
Useful for 'Group by Value' query
Extension point: org.eclipse.mat.nameResolver
6. Distilling Heap Dumps: a Guide to
Using and Extending Memory
Analyzer
Krum Tsvetkov, Andrew Johnson 7
Implement a Name Resolver
7. Distilling Heap Dumps: a Guide to
Using and Extending Memory
Analyzer
Krum Tsvetkov, Andrew Johnson 8
Query
Used for exploring dumps or detailed analysis
May interact with existing queries (context menus)
Integrated into MAT’s menus
Extension point: org.eclipse.mat.api.query
8. Distilling Heap Dumps: a Guide to
Using and Extending Memory
Analyzer
Krum Tsvetkov, Andrew Johnson 9
Implement a Query
9. Distilling Heap Dumps: a Guide to
Using and Extending Memory
Analyzer
Krum Tsvetkov, Andrew Johnson 12
Results from a Query
IResult
ObjectList(atree)
ListResul(atable)
Compositionofresults
inHTML
Histogr(atable)
10. Distilling Heap Dumps: a Guide to
Using and Extending Memory
Analyzer
Krum Tsvetkov, Andrew Johnson 13
Using a Predefined Result
11. Distilling Heap Dumps: a Guide to
Using and Extending Memory
Analyzer
Krum Tsvetkov, Andrew Johnson 20
Request Resolver
Used to identify what a
thread was doing
Appears in the leak suspects
report
Extension point -
org.eclipse.mat.api.requestResolver
12. Distilling Heap Dumps: a Guide to
Using and Extending Memory
Analyzer
Krum Tsvetkov, Andrew Johnson 21
Implement a Request Resolver
13. Distilling Heap Dumps: a Guide to
Using and Extending Memory
Analyzer
Krum Tsvetkov, Andrew Johnson 22
Other extension points
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 problem
Based on classes and classloaders of problem objects
Rendering – org.eclipse.mat.api.renderer
Additional to HTML and CSV
Trigger heap dump – org.eclipse.mat.api.heapDumpProvider
For new VM types
Parser – for new dump types and VMs, such as for Jikes RVM
Snapshot factory – org.eclipse.mat.api.factory
Unlikely to use this as replaces whole snapshot
14. Distilling Heap Dumps: a Guide to
Using and Extending Memory
Analyzer
Krum Tsvetkov, Andrew Johnson 23
In Summary, MAT Offers …
Helpful memory analysis features out-of-the-box
API for extracting data
Application specific analysis can be added as extensions
15. Distilling Heap Dumps: a Guide to
Using and Extending Memory
Analyzer
Krum Tsvetkov, Andrew Johnson 24
Thank You!
Memory Analyzer @ Eclipse:
http://www.eclipse.org/mat
Wiki page for extending Memory Analyzer:
http://wiki.eclipse.org/MemoryAnalyzer/Extending_Memory_Analyzer
Forum:
http://www.eclipse.org/forums/eclipse.memory-analyzer
Blogs:
http://dev.eclipse.org/blogs/memoryanalyzer