2010-09-24 67 views

回答

-1

看起來像你搜索的是一個分析器。 (例如jProfiler或開放源代碼:http://java-source.net/open-source/profilers

+0

謝謝,我無法在jprofiler中找到這個選項 – alex543 2010-09-24 12:38:51

+2

你能否指出任何探查器都有探索perm gen空間的選項。從我所瞭解到的情況來看,他們中的大多數人只是在探索堆積,而不是發電的空間。 – 2011-05-27 18:22:44

10

也許你有一個龐大的代碼庫或正在實施大量的字符串。

嘗試jmap

jmap -permstat <pid> 

(注:permstat選項不可用在Windows)

例子:

$ jmap -permstat 22982 
Attaching to process ID 22982, please wait... 
Debugger attached successfully. 
Server compiler detected. 
JVM version is 17.0-b16 
100691 intern Strings occupying 5641096 bytes. 
finding class loader instances ..Finding object size using Printezis bits and skipping over... 
done. 
computing per loader stat ..done. 
please wait.. computing liveness..done. 
class_loader classes bytes parent_loader alive? type 

<bootstrap>  303  1355992 null   live <internal> 
0xdd159fe8  9  94104 0xdd153c30  live sun/misc/[email protected] 
0xdd153c30  0  0   null   live sun/misc/[email protected] 

total = 3  312  1450096  N/A   alive=3, dead=0  N/A 

您也可以嘗試堆傾倒到一個文件,然後將其加載到Eclipse Memory Analyser,這將爲您提供有用的信息,如泄漏的嫌疑人報告和統治者樹。

jmap -dump:format=b,file=heap.bin 22982 

如果需要,您可以通過使用-XX:MaxPermSize JVM選項來增加您的PermGen空間。

+1

'permstat'選項現在可在Windows上使用。 Java版本「1.6.0_31」 Java™SE運行時環境(內部版本1.6.0_31-b05) Java HotSpot™64位服務器虛擬機(版本20.6-b01,混合模式) – Sydney 2012-04-10 09:18:09