- 1 Frequently Asked Questions
- 1.1 Problems Starting the Memory Analyzer
- 1.2 Problems Getting Heap Dumps
- 1.3 Enable Debug Output
- 1.4 Problems Interpreting Results
- 1.5 How to analyse unreachable objects
Frequently Asked Questions
Problems Starting the Memory Analyzer
java.lang.RuntimeException: No application id has been found.
The Memory Analyzer needs a Java 1.5 VM to run (of course, heap dumps from JDK 1.4.2_12 on are supported). If in doubt, provide the runtime VM on the command line:
MemoryAnalyzer.exe -vm <path/to/java5/bin>
Alternatively, edit the
MemoryAnalyzer.ini to contain (on two lines):
(This error happens, because the MAT plug-in requires a JDK 1.5 via its manifest.mf file and the OSGi runtime dutifully does not activate the plug-in.)
Out of Memory Error while Running the Memory Analyzer
Well, analyzing big heap dumps can also require more heap space. Give it some more memory (possible by running on a 64-bit machine):
MemoryAnalyzer.exe -vmargs -Xmx4g
Alternatively, edit the
MemoryAnalyzer.ini to contain:
For more details, check out the section Running Eclipse in the Help Center. It also contains more details if you are running on Mac OS X.
If you are running the Memory Analyzer inside your Eclipse SDK, you need to edit the
How to run on 64bit VM while the native SWT are 32bit
In short: if you run a 64bit VM, then all native parts also must be 64bit. But what if - like Motif on AIX - native SWT libraries are only available as 32bit version? One can still run the command line parsing on 64bit by executing the following command:
/usr/java5_64/jre/bin/java -jar plugins/org.eclipse.equinox.launcher_1.0.101.R34x_v20080819.jar -consoleLog -application org.eclipse.mat.api.parse path/to/dump.hprof org.eclipse.mat.api:suspects org.eclipse.mat.api:overview org.eclipse.mat.api:top_components
Please make sure you point to the version of the Equinox Launcher available in your installation. This version changes regularly!
org.eclipse.mat.api:suspects argument creates a ZIP file containing the leak suspect report. This argument is optional.
org.eclipse.mat.api:overview argument creates a ZIP file containing the overview report. This argument is optional.
org.eclipse.mat.api:top_components argument creates a ZIP file containing the top components report. This argument is optional.
For parsing IBM dumps with the IBM DTFJ adapter you should use this command:
/usr/java5_64/jre/bin/java -Dosgi.bundles=org.eclipse.mat.dtfj@4:start,org.eclipse.equinox.common@2:start,org.eclipse.update.configurator@3:start,org.eclipse.core.runtime@start -jar plugins/org.eclipse.equinox.launcher_*.jar -consoleLog -application org.eclipse.mat.api.parse path/to/mydump.dmp.zip org.eclipse.mat.api:suspects org.eclipse.mat.api:overview org.eclipse.mat.api:top_components
-Dosgi.bundles option is to ensure that the IBM DTFJ adapter is started correctly in batch mode. In GUI mode this happens automatically. The
-jar plugins/org.eclipse.equinox.launcher_*.jar is another way of finding the launcher which avoids having to specify the exact name of the launcher file (presuming you only have one jar and have not upgraded the installation of MAT).
Problems Getting Heap Dumps
Error: Found instance segment but expected class segment
This error indicates an inconsistent heap dump: The data in the heap dump is written in various segments. In this case, an address expected in a class segment is written into a instance segment.
The problem has been reported in heap dumps generated by jmap on Linux and Solaris operation systems and jdk1.5.0_13 and below. Solution: use latest jdk/jmap version or use jconsole to write the heap dump (needs jdk6).
Error: Invalid heap dump file. Unsupported segment type 0 at position XZY
This almost always means the heap dumps has not been written properly by the Virtual Machine. The Memory Analyzer is not able to read the heap dump.
If you are able to read the dump with other tools, please file a bug report.
Parser found N HPROF dumps in file X. Using dump index 0. See FAQ.
This warning message is printed to the log file, if the heap dump is written via the (obsolete and unstable) HPROF agent. The agent can write multiple heap dumps into one HPROF file. Currently, the Memory Analyzer has no UI support to decide which heap dump to read. By default, MAT takes the first heap dump. If you want to read an alternative dump, one has to start MAT with the system property MAT_HPROF_DUMP_NR=<index>.
Enable Debug Output
To show debug output of MAT:
1. Create or append to the file ".options" in the eclipse main directory the line:
2. Start eclipse with the -debug option. This can be done by appending -debug to the eclipse.ini file in the same directory as the .options file.
3. Be sure to also enable the -consoleLog option to actually see the output.
Problems Interpreting Results
MAT Does Not Show the Complete Heap
Symptom: When monitoring the memory usage interactively, the used heap size is much bigger than what MAT reports.
During the index creation, the Memory Analyzer removes unreachable objects because the various garbage collector algorithms tend to leave some garbage behind (if the object is too small, moving and re-assigning addresses is to expensive). This should, however, be no more than 3 to 4 percent. If you want to know what objects are removed, enable debug output as explained here: MemoryAnalyzer/FAQ#Enable_Debug_Output
Another reason could be that the heap dump was not written properly. Especially older VM (1.4, 1.5) can have problems if the heap dump is written via jmap.
Otherwise, feel free to report a bug.
How to analyse unreachable objects
By default unreachable objects are removed from the heap dump while parsing and will not appear in class histogram, dominator tree, etc. Yet it is possible to open a histogram of unreachable objects. You can do it:
1. From the link on the Overview page
2. From the Query Browser via Java Basics --> Unreachable Objects Histogram
This histogram has no object graph behind it(unreachable objects are removed during the parsing of the heap dump, only class names are stored). Thus it is not possible to see e.g. a list of references for a particular unreachable object.
There is also a possibility to keep unreachable objects while parsing. For this you need to parse the heap dump from the command line providing the argument -keep_unreachable_objects, i.e.
ParseHeapDump.bat -keep_unreachable_objects <heap dump>