标签:imp ref 双击 简介 rac public 需要 mat generate
JHSDB是一款基于服务性代理实现的进程外调试工具。服务性代理是HotSpot虚拟机中一组用于映射Java虚拟机运行信息的,主要基于Java语言实现的API集合。
package com.ryj.hotspot; import java.io.IOException; import org.omg.CORBA.ObjectHolder; public class JHSDB_Test { static class Test { static ObjectHolder staticObj = new ObjectHolder(); ObjectHolder instanceObj = new ObjectHolder(); void foo() { ObjectHolder localObject = new ObjectHolder(); while (true) { try { Thread.sleep(6000 * 1000l); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } public static void main(String[] args) { Test test = new JHSDB_Test.Test(); test.foo(); } }
C:\Program Files\Java\jdk1.8.0_144\bin>jps -l 8400
C:\Program Files\Java\jdk1.8.0_144\lib>java -cp .\sa-jdi.jar sun.jvm.hotspot.HSDB
如果出现报错信息,需要将缺少的文件移动到该lib目录下
3.1 查看堆信息
可以通过Tools -> Heap Parameters 查看或通过Windows -> Console执行命令
hsdb> universe Heap Parameters: ParallelScavengeHeap [ PSYoungGen [ eden = [0x00000000d5d80000,0x00000000d5f73368,0x00000000d7e00000] , from = [0x00000000d8300000,0x00000000d8300000,0x00000000d8800000] , to = [0x00000000d7e00000,0x00000000d7e00000,0x00000000d8300000] ] PSOldGen [ [0x0000000081800000,0x0000000081800000,0x0000000086d80000] ] ]
3.2 查找对象内存地址
hsdb> scanoops 0x00000000d5d80000 0x00000000d8800000 com.ryj.hotspot.JHSDB_Test$ObjectHolder
由于本地环境 scanoops命令报错,后续参考 https://www.bilibili.com/video/av95220376/
标签:imp ref 双击 简介 rac public 需要 mat generate
原文地址:https://www.cnblogs.com/ryjJava/p/12629274.html