Distilling Dumps: a Guide to Using and Extending Memory Analyzer

10,769 views
10,586 views

Published on

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

Published in: Technology
3 Comments
12 Likes
Statistics
Notes
  • @Joe, There's a mechanism to run MAT in headless mode (command-line) where I believe you can achieve the same (http://wiki.eclipse.org/MemoryAnalyzer/FAQ#How_to_run_on_64bit_VM_while_the_native_SWT_are_32bit)... I've never done it myself though..
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • I see a lot of potential for scripted use of heap analysis in CI and testing. In those cases it would be convenient to be able to run a list of queries and compare the results with predetermined thresholds. However, I don’t see any indication that anyone is doing this, nor do I know how to run a script of queries using MAT in a batch command. Pointers?
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Excellent! Enabling awesome insight into application memory for people other than developers too...
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total views
10,769
On SlideShare
0
From Embeds
0
Number of Embeds
445
Actions
Shares
0
Downloads
264
Comments
3
Likes
12
Embeds 0
No embeds

No notes for slide

Distilling Dumps: a Guide to Using and Extending Memory Analyzer

  1. 1. Distilling Heap Dumps: a Guide to Using and Extending Memory Analyzer Krum Tsvetkov (SAP) Andrew Johnson (IBM)
  2. 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. 3. Distilling Heap Dumps: a Guide to Using and Extending Memory Analyzer Krum Tsvetkov, Andrew Johnson 3 Demo  Introduction to Memory Analyzer
  4. 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. 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. 6. Distilling Heap Dumps: a Guide to Using and Extending Memory Analyzer Krum Tsvetkov, Andrew Johnson 7 Implement a Name Resolver
  7. 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. 8. Distilling Heap Dumps: a Guide to Using and Extending Memory Analyzer Krum Tsvetkov, Andrew Johnson 9 Implement a Query
  9. 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. 10. Distilling Heap Dumps: a Guide to Using and Extending Memory Analyzer Krum Tsvetkov, Andrew Johnson 13 Using a Predefined Result
  11. 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. 12. Distilling Heap Dumps: a Guide to Using and Extending Memory Analyzer Krum Tsvetkov, Andrew Johnson 21 Implement a Request Resolver
  13. 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. 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. 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

×