今天我们来一起学习一下如何利用MAT(Memory Analyzer Tool)快速的定位Java程序的内存泄漏问题。本文实验环境为Mac下安装独立版的MAT。
先来科普一下MAT:
The Eclipse Memory Analyzer is a fast and feature-rich Java heap analyzer that helps you find memory leaks and reduce memory consumption.Use the Memory Analyzer to analyze productive heap dumps with hundreds of millions of objects, quickly calculate the retained sizes of objects, see who is preventing the Garbage Collector from collecting objects, run a report to automatically extract leak suspects.
Eclipse Memory Analyzer是一个快速的并且功能丰富的Java堆分析工具,旨在帮助你发现内存泄漏问题和减少内存消耗。
使用MAT来分析生产数以亿计的对象堆转储文件,快速计算存活对象的大小,发现谁在阻碍GC回收对象,形成一个报告来自动提取内存泄漏嫌疑对象。
翻译的磕磕巴巴,英文不差的同学直接看英文吧~
安装独立版本的MAT
官网下载Memory Analyzer 1.9.0 Release,下载地址:
https://www.eclipse.org/mat/downloads.php