Skip to main content
Jump to: navigation, search

MemoryAnalyzer/Contributor Reference

< MemoryAnalyzer
Revision as of 11:57, 31 October 2011 by Andrew (Talk | contribs) (Building MAT with Maven/Tycho)

Getting Started

This page is meant to help you contribute to the Memory Analyzer project.



Install Eclipse and configure it to develop Java 5 applications.

  • We usually use Eclipse 3.6 (Helios). However, as of today, a 3.5, 3.4 or perhaps a 3.3 release works.

Setup your development environment:

  • Via the Update Manager Help -> Install New Software... install:
    • Subversive SVN Team Provider
    • Subversive SVN Connectors (See Subversion Team Provider Download Page for the Update Site URL)
    • Eclipse BIRT Framework
    • IBM Diagnostic Tool Framework for Java (See IBM Diagnostic Tool Framework for Java Version 1.5 to find the archived Update Site.) This is needed to compile and run with the DTFJ adapter which is part of Memory Analyzer and allows Memory Analyzer to read dumps from IBM virtual machines for Java.
  • Configure the Code Formatter Template:
    • Preferences -> Java -> Code Style -> Formatter -> Import... and import this template.


The project has graduated, so there are trunk and 1.0.x, 0.8.0 and 0.7.0 branches. Check out the projects by saving mat.psf file locally, and then using File -> Import -> Team Project Set. Use user name "anonymous" and an empty password.

More information: SVN Howto, Web Access

If you do not have BIRT installed then there will be compilation errors in the org.eclipse.mat.chart and org.eclipse.mat.chart.ui projects.

If you do not have the IBM DTFJ feature installed then there will be compilation errors in the org.eclipse.mat.dtfj project.

If you wish to compile org.eclipse.mat.jruby.resolver then download JRuby from and modify the Java Build Path for JRuby in the properties of org.eclipse.mat.jruby.resolver to point to the JRuby jar.

Launch Configuration

Launch the Memory Analyzer as stand-alone RCP:

  • Create a new Eclipse Application configuration
  • Run a product: org.eclipse.mat.ui.rcp.MemoryAnalyzer
  • Launch with: plug-ins selected below only
    • Deselect org.eclipse.mat.tests
    • Deselect Target Platform and click Add Required Plug-ins
    • Select org.eclipse.pde.runtime (3.3) or org.eclipse.ui.views.log (3.4 or later) to include the Error Log
    • Select if you have installed the IBM DTFJ feature and wish to process dumps from IBM virtual machines
    • Select for help for IBM DTFJ

or as feature plugged into the IDE:

  • Create a new Eclipse Application configuration
  • Run a product: org.eclipse.sdk.ide
  • Launch with: plug-ins selected below only
    • Deselect org.eclipse.mat.tests and org.eclipse.mat.ui.rcp
    • Select if you have installed the IBM DTFJ feature and wish to process dumps from IBM virtual machines
    • Select for help for IBM DTFJ

Export Stand-Alone RCP

To export the RCP, you need an Eclipse 3.6 (or 3.5, 3.4) IDE setup as described above.

Then open org.eclipse.mat.ui.rcp/mat.product and use the Eclipse Product Export Wizard to build the RCP.

JUnit Tests

The unit tests a placed in the org.eclipse.mat.tests project. Execute the tests by right-clicking on the project and choose Run As... -> JUnit Plug-in Test.

The following VM arguments are required in the run configuration for the JUnit Plug-in Test: -Xmx850m -ea

Build Help with DITA

  • Download DITA-OT1.4.2.1 and unzip it into C:\DITA-OT1.4.2.1
  • In plugin select DitaBuild.xml and configure the runtime configuration:
    • right click Run As > Ant Build...
    • add all the libraries from C:\DITA-OT1.4.2.1\lib into the classpath
  • To modify Help documentation modify xml files
    • Download XMLBuddy and copy a product directory (e.g., com.objfac.xmleditor_2.0_72) to the plugins directory of your Eclipse installation.
    • Configure XMLBuddy editor as described here
  • Run ant on DitaBuild.xml to build html files.

Build OQL Parser using JavaCC

  • Download JavaCC 5.0 tar.gz or JavaCC 5.0 zip and unpack it.
  • Copy javacc.jar to the root of the org.eclipse.mat.parser project
  • In plugin org.eclipse.mat.parser select build_javacc.xml
    • right click Run As > Ant Build...
  • Select package org.eclipse.mat.parser.internal.oql.parser
    • Source > Organize Imports
    • Source > Format
    • Ignore the choice conflict message and non-ASCII character message
    • Synchronize with the source repository to add the copyright header etc. back in

Building MAT with Maven/Tycho

The following page describes how Memory Analyzer (p2 repository and standalone RCP applications) can be build using Maven/Tycho: MemoryAnalyzer/Building MAT With Tycho

Ideas for Contributions

This is just a short list of ideas. If you are missing a feature and have some time to contribute, please do not hesitate to contact us.

  • Extensions to the tool adding application knowledge: MAT provides some extension points which can help you to plug-in pieces of information that give meaning to your specific object structures. It would be nice to have in MAT application knowlegde about prominent open source projects, e.g. different Eclipse components, servers like Tomcat and Glassfish, etc... Some examples:
    • using an org.eclipse.mat.api.nameResolver extension one can specify what description should be shown next to an object, similar to a toString() method. See for example bug 273915
    • using an org.eclipse.mat.api.requestResolver extension one can add to the leak report information about what a threads was executing, e.g. tell which HTTP request it was processing, list the URL, parameters, etc... For example bug 318989 proposes an extension which points to the ruby script a thread is executing
    • using an org.eclipse.mat.api.query extension one can add a useful query which will be available all the other queries/commands seen in the tool. See for example bug 256154
  • Documentation
  • Unit Tests

Writing plugins for the Memory Analyzer

If you want to write a plugin for the Memory Analyzer, you can find information on the following pages:

Simultaneous release policies

Retention policy API Policy Capabilities

Back to the top