Mac 安装 MAT内存分析工具

一、 下载

https://www.eclipse.org/downloads/download.php?file=/mat/1.10.0/rcp/MemoryAnalyzer-1.10.0.20200225-macosx.cocoa.x86_64.zip

注意选择国内的下载镜像文件,会很快。如下图所示:

Mac 安装 MAT内存分析工具_第1张图片

二、安装

  1. 使用unzip命令解压刚才下载的zip文件,解压后得到mat文件,如下
    Mac 安装 MAT内存分析工具_第2张图片

  2. 双击mat文件打开会报如下错误
    Mac 安装 MAT内存分析工具_第3张图片

  3. 按照提示打开日志文件,会有如下错误信息

java.lang.IllegalStateException: The platform metadata area could not be written: /private/var/folders/bx/32k5wynn03l5htl0lkzz4bw00000gn/T/AppTranslocation/907E9021-3F3C-441C-BAF5-F40CFD9ADD01/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:70)
	at org.eclipse.core.internal.runtime.DataArea.getStateLocation(DataArea.java:138)
	at org.eclipse.core.internal.preferences.InstancePreferences.getBaseLocation(InstancePreferences.java:44)
	at org.eclipse.core.internal.preferences.InstancePreferences.initializeChildren(InstancePreferences.java:209)
	at org.eclipse.core.internal.preferences.InstancePreferences.<init>(InstancePreferences.java:59)
	at org.eclipse.core.internal.preferences.InstancePreferences.internalCreate(InstancePreferences.java:220)
	at org.eclipse.core.internal.preferences.EclipsePreferences.create(EclipsePreferences.java:349)
	at org.eclipse.core.internal.preferences.EclipsePreferences.create(EclipsePreferences.java:337)
	at org.eclipse.core.internal.preferences.PreferencesService.createNode(PreferencesService.java:393)
	at org.eclipse.core.internal.preferences.RootPreferences.getChild(RootPreferences.java:60)
	at org.eclipse.core.internal.preferences.RootPreferences.getNode(RootPreferences.java:95)
	at org.eclipse.core.internal.preferences.RootPreferences.node(RootPreferences.java:84)
	at org.eclipse.core.internal.preferences.AbstractScope.getNode(AbstractScope.java:38)
	at org.eclipse.core.runtime.preferences.InstanceScope.getNode(InstanceScope.java:77)
	at org.eclipse.ui.preferences.ScopedPreferenceStore.getStorePreferences(ScopedPreferenceStore.java:225)
	at org.eclipse.ui.preferences.ScopedPreferenceStore.<init>(ScopedPreferenceStore.java:132)
	at org.eclipse.ui.plugin.AbstractUIPlugin.getPreferenceStore(AbstractUIPlugin.java:287)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:609)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:597)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
	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:388)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:656)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:592)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1498)
  1. 解决方式如下
    右键mat显示包内容,进入Contents->MacOS下面,会有一个MemoryAnalyzer的命令。
    打开终端,进入此路径找到MemoryAnalyzer,
    一般路径是 /Users/xx/Downloads/memoryAnalyzer/mat.app/Contents/MacOS/
    其中 /Users/xx/Downloads/memoryAnalyzer/ 是我的解压路径
    运行如下命令打开
./MemoryAnalyzer

成功启动,如下,然后就可以打开需要分析的文件。
Mac 安装 MAT内存分析工具_第4张图片

你可能感兴趣的:(macos,Liunx,macos,java,eclipse)