2013-11-26 30 views
0

我正在關注此tutorial以查找內存泄漏。我完成了以下所有步驟(第6頁),結果如下。問題是我不確定這個結果是否好,以及是否有任何內存泄漏如何解決?如何使用VisualVM 1.3.6查找內存泄漏?

The way of measuring is: 
•(Switch off the automatic refreshing.) 
•In Visual VM start the garbage collector, by pressing the corresponding icon. 
•In Visual VM reset the results by pressing the 「Reset collected results」 icon. Now all 
delta counters are reset. 
•Perform your application procedure one or several times. 
•In Visual VM press start the garbage collector again 

Result-1

在接下來頁教程詢問要運行的我沒有堆轉儲(第7頁),其結果對於char []如以下

Result-2

回答

-2

Memory Analyzer (MAT)更更好。

首先使用你需要轉儲JVM堆:jmap -dump:format=b,file=<file> <pid>

然後使用MAT打開轉儲文件。

分析後,你可以看到一個圖表是這樣的:

https://www.eclipse.org/mat/home/mat_thumb.png

在圖表下方,你可以看到memroy泄漏報告。