使用JProfiler分析定位java内存泄露memory leak

使用jprofiler远程profile JBoss应用服务器

项目中发现JBoss出现内存泄露, 从2G一直涨到3.5G左右

开始考虑使用jmap dump出内存来, 在用jhap打开浏览器分析。

想到JProfiler可以看类的引用关系, 更容易分析内存泄露, 所以决定使用JProfile。 同时应为JBoss运行在远端的服务器, 所以要使用remote attachment

1) 安装JProfiler. In Windows install jprofiler_windows-x64_8_0_2.exe; in Linux, install jprofiler_linux_8_0_2.rpm.

2) 修改JBoss的/opt/jboss/default/bin/standalone.conf

    add VM parameter: -agentpath:/opt/jprofiler8/bin/linux-x64/libjprofilerti.so=port=8849  // 需要Jprofile连接一下, java JVM才会启动。 

    也可以添加,nowait. 区别是, 加入这个参数后, 就不用jprofile连接一下了。

3) 启动JBoss

4) add ssh port forward using PuTTY

5) 在windows上启动JProfiler来远程连接Linux上的JBoss

    Open JProfiler client. -> Start center -> New session tab -> New session button -> select remote -> configure host and port of target jvm -> Start

    Start target JVM. it will pause and wait JProfiler to attach it.

    In JProfiler client, click Attach and OK

    When the evaluation ends, the client still can open but it doesn’t wor

原文地址:https://www.cnblogs.com/lpthread/p/3510088.html