mac pro m1: install dump file memory analysis tool - MAT

0 Preface

This article mainly explains the installation of Jprofiler under mac m1, and the installation core steps are also applicable to other systems

1. Installation

If you are using eclipse, you can install MAT directly in the plug-in, because I am using idea development, so I choose to install the MAT tool independently

1. Download address: https://www.eclipse.org/mat/downloads.php

Choose the version you need, here I choose the mac arm architecture version, note that the latest version 1.14 needs jdk17+
insert image description here
if it is jdk1.8, you need to download other versions: https://www.eclipse.org/mat/previousReleases.php

Here I choose version 1.7.0. I tried versions 1.8.0 and 1.8.1 before, but the page cannot be displayed after installation, so choose carefully

insert image description here

2. If it is a mac, it may appear 无法打开“mat”,因为它来自身份不明的开发者. For other systems, please skip this step

insert image description here

Enter 系统偏好设置- 隐私与安全性, choose to still open

insert image description here
Select Open
insert image description here
3. If the following error occurs during the installation process

java.lang.IllegalStateException: The platform metadata area could not be written

insert image description here

Enter /mat.app/Contents/MacOSthe folder and execute the command:

./MemoryAnalyzer -data ./dump

insert image description here

4. If it continues to appear

The JVM shared library "/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home/bin/../jre/lib/server/libjvm.dylib"
does not contain the JNI_CreateJavaVM symbol.

This is because the jdk that is adapted to the arm version—zulu jdk is used. We switch jdk to x86 architecture

mac jdk switch

vim ~/.bash_profile

insert image description here
Effective environment variable

source /etc/profile ~/.bash_profile

Check the effect
insert image description here
5, execute again./MemoryAnalyzer -data ./dump

When the dump folder is found, close the command window

insert image description here

6. Re-open MAT, the following interface appears, indicating that the installation is successful

insert image description here

7. Here you will find that the interface does not move, refer to the official instructions: https://www.eclipse.org/forums/index.php/t/1090889/

insert image description here

8. Download the component from the first step in the above figure, and then execute the command replacement:

mv 下载包路径/swt-4.7.1a-cocoa-macosx-x86_64/swt.jar 你的MAT路径/mat.app/Contents/Eclipse/plugins/org.eclipse.swt.cocoa.macosx.x86_64_3.104.2.v20160212-1350.jar
# eg
mv /Users/wuhanxue/Downloads/swt-4.7.1a-cocoa-macosx-x86_64/swt.jar /Library/software/MAT_1.7.0/mat.app/Contents/Eclipse/plugins/org.eclipse.swt.cocoa.macosx.x86_64_3.104.2.v20160212-1350.jar

9. Open MAT again and find that it is running normally. Open a new dump file for analysis, and it is also running normally. The installation is successful!

insert image description here

recommended reading

1. JVM: A comprehensive understanding of online server memory overflow (OOM) problem handling solutions

Guess you like

Origin blog.csdn.net/qq_24950043/article/details/129640552