Eclipse Memory Analyzer
Upcoming SlideShare
Loading in...5

Eclipse Memory Analyzer






Total Views
Views on SlideShare
Embed Views



4 Embeds 128 96 30 1 1



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.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
  • I would like know how to work eclipse memory analyzer
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

Eclipse Memory Analyzer Eclipse Memory Analyzer Presentation Transcript

  • Eclipse Memory Analyzer – More Than Just a Heap Walker Andrew Johnson (IBM) Elena Nayashkova (SAP)
  • Introduction
    • Java memory-related problems are very common
    • Many are extremely difficult to analyze
    • Analysis requires expertise in the analyzed source code
    • Eclipse Memory Analyzer:
      • Simplifies memory analysis
      • Extensible
      • Free for download @
  • A Little Bit of History
    • Problem #1: multi-GB heap dumps from 64-bit machines
      • Quickly open and re-open a heap dump on 32-bit machines
    • Problem #2: millions of objects. Where is the „needle“?
      • Dominator Tree: fast calculation of retained memory
      • Meaningful names for class loaders: see components
      • SQL-like language: create custom queries
    • Problem #3: complexity of analysis
      • Reports on memory leak suspects and checks for known antipatterns
    • Problem #4: HPROF heap dumps only
      • Support for IBM system dumps
    View slide
  • Agenda
    • Support for IBM System Dumps
    • Automated Analysis
    • Equinox OSGi Bundle Explorer
    View slide
  • IBM Dumps
    • VM dumps differ between vendors (e.g. IBM and Sun)
    • Diagnostic Tooling Interface for Java (DTFJ) hides differences between dumps from different VMs
    • DTFJ is being standardized via JSR 326
    • Need a VM option to get a system (= process) dump on OutOfMemoryError
    • System dumps are post-processed with JExtract
    • Adapter for MAT available from IBM to read the dumps
    • Adapter uses DTFJ to open the dump & read the object/class data, then passes the data into MAT
    • MAT then displays data just like an HPROF dump
  • Demo
    • DTFJ – adapter
      • Acquire and open an IBM heap dump
      • Run application with dump option java -Xdump:system:events=throw,filter=java/lang/OutOfMemoryError
      • Postprocess dump to add extra VM data jextract <name of dump> .dmp
      • Open the jextract-ed file in Memory Analyzer and analyze as Sun heap dump
  • Demo
    • Memory Leak Hunter
      • Automatically detect memory leak suspects
      • Discover if the issue is known (and a fix available)
      • Collect details for in depth analysis by the code experts
  • Report Overview Any up-to-date architecture loads components with separate class loaders, be it OSGi or JEE application servers. Extensible to display meaningful names. Classification for trouble ticket system: less ping-pong of trouble tickets. Search by keywords: identify if problem is known One big object: memory leak suspect
  • Report Details Accumulated objects A significant drop in the retained sizes shows the accumulation point The chain of objects and references which keep the suspect alive
  • Demo
    • Top Components Report
      • Analyze components, that occupy more memory, than a certain threshold
      • Give hints where memory footprint can be optimized
      • Check for known antipatterns
  • Report Details
  • Report Details
  • Equinox OSGi Bundle Explorer
    • Core runtime of Eclipse uses Equinox OSGi framework. A plug-in is an OSGi bundle.
    • For each bundle present in your Equinox-based application Memory Analyzer’s Bundle Explorer shows:
      • name and version
      • state and location
      • dependencies and dependents
      • services contributed and consumed
      • extension points and extensions
      • hosted bundle fragments
  • Demo
    • Equinox OSGi Bundle
    • Explorer
      • Show the state of all bundles in the analyzed application
      • What other bundles does my bundle depend on at runtime?
      • Detect duplicate bundles
  • What’s Next?
    • Compare multiple heap dumps
    • Acquire heap dumps interactively
    • Become part of Galileo Simultaneous Release
  • Thank You!
    • Memory Analyzer @ Eclipse:
    • IBM DTFJ-adapter for Eclipse Memory Analyzer:
    • Memory Analyzer Wiki @ SAP:
    • =/display/Java/ Java+Memory+Analysis
    • Blogs:
  • 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
  • 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…
    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)