MAC使用 Eclipse Memory Analyzer的问题

今天下载了新版本1.8.0的mat使用的时候出现了弹窗,说不能用,让我看一个目录下面的log文件。
发开以后发现文件内容为:

~ » cat /Users/rollenholt/.eclipse/1813544272_macosx_cocoa_x86_64/configuration/1532577701712.log
!SESSION 2018-07-26 12:01:41.508 -----------------------------------------------
eclipse.buildId=unknown
java.version=9.0.4
java.vendor=Oracle Corporation
BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=zh_CN
Framework arguments:  -keyring /Users/rollenholt/.eclipse_keyring
Command-line arguments:  -os macosx -ws cocoa -arch x86_64 -keyring /Users/rollenholt/.eclipse_keyring

!ENTRY org.eclipse.osgi 4 0 2018-07-26 12:01:45.353
!MESSAGE Application error
!STACK 1
java.lang.IllegalStateException: The platform metadata area could not be written: /private/var/folders/g4/mqnly8395t1c2lr4390qfxth0000gn/T/AppTranslocation/8EB08AAF-B73D-43CE-83A1-424212110282/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)
------------------------------------------------------------

于是google了一波发现原因居然是因为我下载完mat以后,直接在mac的Downloads目录打开的,应该先把
这个mac应用程序移动到mac的应用程序目录下。

我移动以后打开就没事了,一切正常。

另外关于MAT的配置,一般都建议在下载完成以后修改一下/Applications/mat.app/Contents/Eclipse/MemoryAnalyzer.ini文件

调大一下-Xmx参数。我直接修改为4G

修改以后的文件内容为:

/Applications/mat.app/Contents/Eclipse » cat /Applications/mat.app/Contents/Eclipse/MemoryAnalyzer.ini
-startup
../Eclipse/plugins/org.eclipse.equinox.launcher_1.5.0.v20180512-1130.jar
--launcher.library
../Eclipse/plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.700.v20180518-1200
-vmargs
-Xmx4096m
-Dorg.eclipse.swt.internal.carbon.smallFonts
-XstartOnFirstThread
本文版权归作者所有,禁止一切形式的转载,复制等操作
赞赏

微信赞赏支付宝赞赏

发表评论

电子邮件地址不会被公开。 必填项已用*标注