• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content

Loading…

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

Like this presentation? Why not share!

Distilling Dumps: a Guide to Using and Extending Memory Analyzer

on

  • 9,077 views

Eclipse Summit Europe 2010 presentation: "Distilling Dumps: a Guide to Using and Extending Memory Analyzer" ...

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

Statistics

Views

Total Views
9,077
Views on SlideShare
8,701
Embed Views
376

Actions

Likes
10
Downloads
232
Comments
3

27 Embeds 376

http://android-tweaks.blogspot.com 202
http://www.eclipsecon.org 101
http://android-tweaks.blogspot.in 28
http://android-tweaks.blogspot.ru 5
http://android-tweaks.blogspot.hk 4
http://android-tweaks.blogspot.ca 3
http://android-tweaks.blogspot.co.uk 3
http://android-tweaks.blogspot.kr 3
http://android-tweaks.blogspot.com.br 2
http://android-tweaks.blogspot.be 2
http://android-tweaks.blogspot.de 2
http://android-tweaks.blogspot.ch 2
http://android-tweaks.blogspot.co.il 2
http://android-tweaks.blogspot.tw 2
http://android-tweaks.blogspot.ie 2
http://android-tweaks.blogspot.gr 2
http://android-tweaks.blogspot.jp 1
http://android-tweaks.blogspot.com.au 1
https://www.eclipsecon.org 1
http://android-tweaks.blogspot.mx 1
http://android-tweaks.blogspot.fr 1
http://android-tweaks.blogspot.sg 1
http://android-tweaks.blogspot.ro 1
http://android-tweaks.blogspot.pt 1
http://android-tweaks.blogspot.se 1
http://businessworldti.wordpress.com 1
http://android-tweaks.blogspot.com.es 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel

13 of 3 previous next Post a comment

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
  • @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..
    Are you sure you want to
    Your message goes here
    Processing…
  • 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?
    Are you sure you want to
    Your message goes here
    Processing…
  • Excellent! Enabling awesome insight into application memory for people other than developers too...
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Distilling Dumps: a Guide to Using and Extending Memory Analyzer Distilling Dumps: a Guide to Using and Extending Memory Analyzer Presentation Transcript

    • Distilling Heap Dumps: a Guide to Using and Extending Memory Analyzer Krum Tsvetkov (SAP) Andrew Johnson (IBM)
    • Memory Analyzer overview
      • Works with heap dumps – post-mortem analysis
      • UI and programmatic access to data in the heap dumps
      • Automatic problem recognition
      • Extendable
    • Demo
      • Introduction to Memory Analyzer
    • 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
    • Programmatic access to a Snapshot
      • ISnapshot – the whole dump
        • Index methods – operate on int indexes instead of addresses
        • Get classes, objects, retained sizes, GC roots
      • ISnapshotInfo – details about the dump
      • IClass – a class object, can get static fields + instances
      • IObject – a general Java object
        • IInstance – a non-array object, resolveValue() for fields
          • IClassLoader – can get defined classes
        • IArray – general array, getLength()
          • IPrimitiveArray – getValueAt(), getValueArray() for primitive values
          • IObjectArray – getReferenceArray() for addresses (longs)
      • ObjectReference – a value of a reference field
    • 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
    • Implement a Name Resolver
    • 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
    • Implement a Query
    • Command name and menu location
      • Annotations on the query class
      • @Name – the visible name on the menu, nn| to set order
      • @Category – the menu section, / to cascade, nn| to set order
      • @Help – explanation of query
      • @HelpUrl – link into the help system
      • @Icon – icon for the menu
      • @CommandName – used for command line and query browser
      • @Usage – example usage, defaults to command name + args
      • @Menu – used for multiple menu items with options for a query
      • Also can be put into an annotations.properties file in the package directory, SimpleClassName.category = Java Basics
    • Arguments into a query
      • @Argument annotation on public fields
      • Known datatypes for snapshot, objects, objectids – filled in from the context
      • IHeapObjectArgument – good way of getting objects
      • Int, pattern, boolean supplied via query wizard or via command line
      • IContextObject – row with one object
      • IContextObjectSet – row with multiple objects
      • Use arrays or lists for multiple items
      • File for input or output files
      • Advice qualifies the argument with extra data
    • Results from a Query IResult ObjectList (a tree) ListResult (a table) Composition of results in HTML Histogram (a table)
    • Using a Predefined Result
    • IResult – the return from a query
      • ITable
        • Histogram – objects grouped by class
        • ListResult – extracts properties from a list of helper objects
        • PropertiesResult – extracts properties from a single object
        • TQuantize – group by value
      • ITree
        • ObjectListResult.Outbound, Inbound – object tree expandable
      • IResultPie
        • PieFactory – pie charts
      • TextResult – plain text or HTML
    • Composed Results
      • CompositeResult – container for results, appear as tabs
      • Spec
        • SectionSpec – container for results as report page
        • QuerySpec – container for result of a query and command
    • Histogram
    • ObjectListResult.Outbound
    • Pie Chart
    • SectionSpec
    • Request Resolver
      • Used to identify what a thread was doing
      • Appears in the leak suspects report
      • Extension point - org.eclipse.mat.api.requestResolver
    • Implement a Request Resolver
    • 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
    • In Summary, MAT Offers …
      • Helpful memory analysis features out-of-the-box
      • API for extracting data
      • Application specific analysis can be added as extensions
    • 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
    • Binary Heap Dump
      • A heap dump is a snapshot of objects that are alive at one point in time.
      • It contains:
              • Objects: fields, references, primitive values, …
              • Classes: class loader, super class, static fields, …
          • A heap dump does not contain
              • where the objects have been created
              • which objects have been garbage collected
      For Your Reference IOIOII IOIIOI OIOIO IIOIIOI IOIOII IOIIOI OIOIO IIOIIOI
    • How to Get a Heap Dump
      • Non-Interactive
        • -XX:+HeapDumpOnOutOfMemoryError
      • On Demand
        • JDK1.4.2_12 and -XX:+HeapDumpOnCtrlBreak
        • JDK6 and Jconsole
      • 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
      For Your Reference
    • Shallow and Retained Size
      • 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
      For Your Reference Set of elements Retained Set C C, F, G, J K K C, K C, F, G, J, K, I
    • Dominator Tree
      • The Dominator Tree is a Transformation of the Cyclic Object Graph into a “Keep-Alive” Tree:
        • Every node in the Tree is directly responsible for keeping alive its children
        • Object X dominates object Y if all paths from the roots to Y run through X
      For Your Reference
      • Benefits:
      • Fast calculation of the retained size (sum all children)
      • List of distinct big
      • objects (first level of the tree)
      • Fast identification of
      • responsible objects (just go up the tree)