---
title: "Java堆内存溢出调试工具"
author: "clearity"
date: "2014-04-28T20:59:02Z"
tags: []
categories: ["互联网"]
slug: "java"
draft: false
lastmod: "2014-04-28T22:16:15Z"
id: 2056361
url: "https://clearity.iteye.com/blog/2056361"
---

可以通过以下选项设置当虚拟机发生内存溢出异常的时候生成堆栈转储信息：

 

```
-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp/mydump.hprof
```

 

分析转储信息的方式：

安装Eclipse内存分析器（[eclipse memory analyzer](http://www.eclipse.org/mat/downloads.php)）

使用大内存设置启动Eclipse：eclipse -vmargs -Xmx6G

打开Eclipse内存分析选项页： Window &gt; Open Perspective &gt; Other &gt; Memory Analysis