15
Distilling Heap Dumps: a Guide to Using and Extending Memory Analyzer Krum Tsvetkov (SAP) Andrew Johnson (IBM)

Distilling Dumps: a Guide to Using and Extending Memory Analyzer

Embed Size (px)

DESCRIPTION

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

Citation preview

Page 1: Distilling Dumps: a Guide to Using and Extending Memory Analyzer

Distilling Heap Dumps: a Guide to Using and Extending Memory Analyzer

Krum Tsvetkov (SAP)

Andrew Johnson (IBM)

Page 2: Distilling Dumps: a Guide to Using and Extending Memory Analyzer

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

Page 3: Distilling Dumps: a Guide to Using and Extending Memory Analyzer

Distilling Heap Dumps: a Guide to Using and Extending Memory Analyzer

Krum Tsvetkov, Andrew Johnson 3

Demo

Introduction to Memory Analyzer

Page 4: Distilling Dumps: a Guide to Using and Extending Memory Analyzer

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

Page 5: Distilling Dumps: a Guide to Using and Extending Memory Analyzer

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

Page 6: Distilling Dumps: a Guide to Using and Extending Memory Analyzer

Distilling Heap Dumps: a Guide to Using and Extending Memory Analyzer

Krum Tsvetkov, Andrew Johnson 7

Implement a Name Resolver

Page 7: Distilling Dumps: a Guide to Using and Extending Memory Analyzer

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

Page 8: Distilling Dumps: a Guide to Using and Extending Memory Analyzer

Distilling Heap Dumps: a Guide to Using and Extending Memory Analyzer

Krum Tsvetkov, Andrew Johnson 9

Implement a Query

Page 9: Distilling Dumps: a Guide to Using and Extending Memory Analyzer

Distilling Heap Dumps: a Guide to Using and Extending Memory Analyzer

Krum Tsvetkov, Andrew Johnson 12

Results from a Query

IResult

ObjectList

(a

tree

)

ListResult

(a

tabl

e)

Com

posi

tion

of

resu

lts in

HT

ML

Histogram

(a

tabl

e)

Page 10: Distilling Dumps: a Guide to Using and Extending Memory Analyzer

Distilling Heap Dumps: a Guide to Using and Extending Memory Analyzer

Krum Tsvetkov, Andrew Johnson 13

Using a Predefined Result

Page 11: Distilling Dumps: a Guide to Using and Extending Memory Analyzer

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

Page 12: Distilling Dumps: a Guide to Using and Extending Memory Analyzer

Distilling Heap Dumps: a Guide to Using and Extending Memory Analyzer

Krum Tsvetkov, Andrew Johnson 21

Implement a Request Resolver

Page 13: Distilling Dumps: a Guide to Using and Extending Memory Analyzer

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

Page 14: Distilling Dumps: a Guide to Using and Extending Memory Analyzer

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

Page 15: Distilling Dumps: a Guide to Using and Extending Memory Analyzer

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