简体   繁体   中英

How heap dump collects data

I know there are numerous ways to take heap dump of a Java Process. But I would like to know how these data are collected.

In other words, what component in the JVM provides this heap data, when dump is triggered.

Generally speaking, a tool like "jmap" talks to components that are not part of the Java public APIs: stuff in the sun.jvm.hotspot.* packages.

  • If "jmap" is dumping an attached JVM, it interacts with the JVM's debug agent via JVMTI.

  • In other cases, "jmap" uses various classes in sun.jvm.hotspot.* to extract the information from the JVM processes address space or a core dump.

If you want to understand the gory details, download the OpenJDK source code (pick any version), locate the JMap.java file, and start reading.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM