posts - 21,  comments - 0,  trackbacks - 0
JConsole:
1) java -Dcom.sun.management.jmxremote MainClass
2) JDK\bin\jconsole {java pid}
在jconsole的界面可以看到简单的内存使用情况

Hat:
1) java -Xrunhprof:file=dump.hprof,format=b MainClass
2) hat dump.hprof
3) Browse http://localhost:7000
dump.hprof是java程序产生的dump文件名

如何用netbeans5.5 profiler 调试 memory Leak (JDK1.5)
1) 下载如下包,
netbeans-5_5-windows.exe -- netbeans 5.5
netbeans-profiler-5_5-win.exe -- profiler
profiler-server-55-windows-15.zip -- remote pack. 与profiler是分开的,作remote attach的时候要用
2) netbeans 与profiler 都安装在你本地
3)将profiler-server-55-windows-15.zip解压到你远程的机器
4)运行profiler-server-55-windows-15\bin\calibrate.bat
5) 把下面的参数加到你的JVM启动参数里面:
 -agentpath:<profiler-server-55-windows-15>\lib\deployed\jdk15\windows\profilerinterface.dll=<profiler-server-55-windows-15>\lib,5140
6) 启动你的Java.exe时,java 程序对等待你attach,通过netbeans attach后,你可以看到Objects使用的信息了

记得要选中:"Record both object creation and garbage collection (Object Liveness Profiling)"
This option provides additional information about how many objects of each type are still alive, as well as data on live objects. The results are displayed in the Object Liveness Results.
posted on 2007-02-14 17:56 自强不息的猪 阅读(929) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航:
 
<2007年2月>
28293031123
45678910
11121314151617
18192021222324
25262728123
45678910

常用链接

留言簿(3)

随笔档案(21)

文章分类(2)

文章档案(8)

links

最新随笔

搜索

  •  

积分与排名

  • 积分 - 14866
  • 排名 - 1996

最新评论

阅读排行榜

评论排行榜