Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
MAT headless mode
#!/bin/sh
#
# This script parses a heap dump.
#
# Usage: ParseHeapDump.sh <path/to/dump.hprof> [report]*
#
# The leak report has the id org.eclipse.mat.api:suspects
# The top component report has the id org.eclipse.mat.api:top_components
#
./MemoryAnalyzer -consolelog -application org.eclipse.mat.api.parse "$@"
#!/bin/bash
#
# run with './suspect_report.sh path_to_heapdump'
#
nohup ./ParseHeapDump.sh $1 org.eclipse.mat.api:suspects org.eclipse.mat.api:overview org.eclipse.mat.api:top_components -vmargs -Xmx96g -XX:-UseGCOverheadLimit > mat_report.out &
@mrbuk

This comment has been minimized.

Copy link
Owner Author

mrbuk commented May 20, 2015

Prerequisites

Note: The ParseHeapDump.sh script should be part of your MAT distribution. So to run a suspect report the second script and the MAT distribution is needed.

Run

First see if the heap size defined in the suspect_report.sh is right for your case. If so execute ./suspect_report.sh heap_dump

As a result an archive with the report in form of HTML files will be created. (Resulting files are usually located in the MAT directory if you have executed the application from that location).

Note: This will only create the suspects, overview and top components report. If you want other stuff or only one report (e.g. suspect) replace the report id from the suspect_report.sh script with only the desired report and execute directly from command line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.