MAT Memory Analysis Tool - Standalone Installation

 1. Background

When OOM occurs during the running of the java program, we can use the powerful memory analysis tool MAT to track the problem, but since we are accustomed to using idea development, and downloading eclipse for MAT is too troublesome, install the MAT independent version.

2. Installation

Download address: https://eclipse.org/mat/downloads.php, as follows



Select the corresponding version of your system to download, and get a zip file after downloading. The author uses Mac OSX (Mac/Cocoa x86_64) here . After decompression, the mat file is obtained.

If there is no problem with double-clicking to open here, you can start to use it normally; if the double-click prompts abnormal, then continue to look down, and the prompt is as follows

 

 

Enter the log file according to the prompt path, the exception information:
java.lang.IllegalStateException: The platform metadata area could not be
written: /private/var/folders/d_/9dsdb3jd0bbg2lq9kvhdlvz00000gn/T/AppTranslocation/13816EDC-675E-4D44-9337-C5A7658C046A/d/mat.app/Contents/MacOS/workspace/
.metadata.  By default the platform writes its content
under the current working directory when the platform is launched.  Use the -data parameter to
specify a different content area for the platform.
        at org.eclipse.core.internal.runtime.DataArea.assertLocationInitialized(DataArea.java:61)
        at org.eclipse.core.internal.runtime.DataArea.getStateLocation(DataArea.java:129)
        at org.eclipse.core.internal.preferences.InstancePreferences.getBaseLocation(InstancePreferences.java:44)
        at org.eclipse.core.internal.preferences.InstancePreferences.initializeChildren(InstancePreferences.java:199)
        at org.eclipse.core.internal.preferences.InstancePreferences.<init>(InstancePreferences.java:59)
        at org.eclipse.core.internal.preferences.InstancePreferences.internalCreate(InstancePreferences.java:209)
        at org.eclipse.core.internal.preferences.EclipsePreferences.create(EclipsePreferences.java:391)
        at org.eclipse.core.internal.preferences.EclipsePreferences.create(EclipsePreferences.java:379)
        at org.eclipse.core.internal.preferences.PreferencesService.createNode(PreferencesService.java:389)
        at org.eclipse.core.internal.preferences.RootPreferences.getChild(RootPreferences.java:63)
        at org.eclipse.core.internal.preferences.RootPreferences.getNode(RootPreferences.java:101)
        at org.eclipse.core.internal.preferences.RootPreferences.node(RootPreferences.java:90)
        at org.eclipse.core.internal.preferences.AbstractScope.getNode(AbstractScope.java:38)
        at org.eclipse.core.runtime.preferences.InstanceScope.getNode(InstanceScope.java:80)
        at org.eclipse.ui.preferences.ScopedPreferenceStore.getStorePreferences(ScopedPreferenceStore.java:229)
        at org.eclipse.ui.preferences.ScopedPreferenceStore.<init>(ScopedPreferenceStore.java:133)
        at org.eclipse.ui.plugin.AbstractUIPlugin.getPreferenceStore(AbstractUIPlugin.java:288)
        at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:620)
        at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)
        at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:606)
        at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
        at org.eclipse.mat.ui.rcp.Application.start(Application.java:26)
        at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:669)
        at org.eclipse.equinox.launcher.Main.basicRun(Main.java:608)
        at org.eclipse.equinox.launcher.Main.run(Main.java:1515)

This is a bug of eclipse, record address: https://bugs.eclipse.org/bugs/show_bug.cgi?id=339647#c5

Solution (take mac as an example)

Right-click mat to display the package content, go to Contents->MacOS, there will be a MemoryAnalyzer command.

Open the terminal, enter this path to find MemoryAnalyzer, run

./MemoryAnalyzer -data ./dump

Successful startup, of course, it is also possible to start by typing the full path, and the dump file name can be customized.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326327908&siteId=291194637