MAT内存分析工具-独立版安装

https://blog.csdn.net/mahl1990/article/details/79298616

 

2018年02月09日 15:03:43 平凡公民 阅读数:8423

一、背景

在java程序运行中发生OOM的时候,我们可以使用强大的内存分析工具MAT进行问题跟踪,但由于习惯了使用idea开发,再为了MAT下载个eclipse太麻烦,所以安装MAT独立版。

二、安装

下载地址:https://eclipse.org/mat/downloads.php

选择自己系统相应的版本下载,下载完得到一个zip文件,笔者这里使用的是Mac OSX (Mac/Cocoa x86_64),解压后得到mat文件

如果这里双击打开没问题,则可以开始正常使用了;如果双击提示异常,那么继续往下看,提示如下 

Java代码 

  1. 按照提示路径进入日志文件,异常信息:  
  2. java.lang.IllegalStateException: The platform metadata area could not be   
  3. written: /private/var/folders/d_/9dsdb3jd0bbg2lq9kvhdlvz00000gn/T/AppTranslocation/13816EDC-675E-4D44-9337-C5A7658C046A/d/mat.app/Contents/MacOS/workspace/  
  4. .metadata.  By default the platform writes its content  
  5. under the current working directory when the platform is launched.  Use the -data parameter to  
  6. specify a different content area for the platform.  
  7.         at org.eclipse.core.internal.runtime.DataArea.assertLocationInitialized(DataArea.java:61)  
  8.         at org.eclipse.core.internal.runtime.DataArea.getStateLocation(DataArea.java:129)  
  9.         at org.eclipse.core.internal.preferences.InstancePreferences.getBaseLocation(InstancePreferences.java:44)  
  10.         at org.eclipse.core.internal.preferences.InstancePreferences.initializeChildren(InstancePreferences.java:199)  
  11.         at org.eclipse.core.internal.preferences.InstancePreferences.<init>(InstancePreferences.java:59)  
  12.         at org.eclipse.core.internal.preferences.InstancePreferences.internalCreate(InstancePreferences.java:209)  
  13.         at org.eclipse.core.internal.preferences.EclipsePreferences.create(EclipsePreferences.java:391)  
  14.         at org.eclipse.core.internal.preferences.EclipsePreferences.create(EclipsePreferences.java:379)  
  15.         at org.eclipse.core.internal.preferences.PreferencesService.createNode(PreferencesService.java:389)  
  16.         at org.eclipse.core.internal.preferences.RootPreferences.getChild(RootPreferences.java:63)  
  17.         at org.eclipse.core.internal.preferences.RootPreferences.getNode(RootPreferences.java:101)  
  18.         at org.eclipse.core.internal.preferences.RootPreferences.node(RootPreferences.java:90)  
  19.         at org.eclipse.core.internal.preferences.AbstractScope.getNode(AbstractScope.java:38)  
  20.         at org.eclipse.core.runtime.preferences.InstanceScope.getNode(InstanceScope.java:80)  
  21.         at org.eclipse.ui.preferences.ScopedPreferenceStore.getStorePreferences(ScopedPreferenceStore.java:229)  
  22.         at org.eclipse.ui.preferences.ScopedPreferenceStore.<init>(ScopedPreferenceStore.java:133)  
  23.         at org.eclipse.ui.plugin.AbstractUIPlugin.getPreferenceStore(AbstractUIPlugin.java:288)  
  24.         at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:620)  
  25.         at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)  
  26.         at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:606)  
  27.         at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)  
  28.         at org.eclipse.mat.ui.rcp.Application.start(Application.java:26)  
  29.         at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)  
  30.         at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)  
  31.         at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)  
  32.         at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)  
  33.         at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)  
  34.         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  
  35.         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)  
  36.         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)  
  37.         at java.lang.reflect.Method.invoke(Method.java:498)  
  38.         at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:669)  
  39.         at org.eclipse.equinox.launcher.Main.basicRun(Main.java:608)  
  40.         at org.eclipse.equinox.launcher.Main.run(Main.java:1515)  

这是eclipse的一个bug,记录地址:https://bugs.eclipse.org/bugs/show_bug.cgi?id=339647#c5

 

解决办法(以mac为例)

右键mat显示包内容,进入Contents->MacOS下面,会有一个MemoryAnalyzer的命令。

打开终端,进入此路径找到MemoryAnalyzer,运行

 
./MemoryAnalyzer -data ./dump

成功启动,当然敲全路径启动也是可以的,dump文件名可以自定义。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值