简体   繁体   English

堆转储如何收集数据

[英]How heap dump collects data

I know there are numerous ways to take heap dump of a Java Process. 我知道有很多方法可以进行Java进程的堆转储。 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. 换句话说,当转储被触发时,JVM中的哪个组件提供了此堆数据。

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. 一般而言,诸如“ jmap”之类的工具会与不属于Java公共API的组件进行对话: sun.jvm.hotspot.*软件包中的内容。

  • If "jmap" is dumping an attached JVM, it interacts with the JVM's debug agent via JVMTI. 如果“ jmap”正在转储附加的JVM,则它将通过JVMTI与JVM的调试代理进行交互。

  • 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. 在其他情况下,“ jmap”使用sun.jvm.hotspot.*各种类从JVM进程地址空间或核心转储中提取信息。

If you want to understand the gory details, download the OpenJDK source code (pick any version), locate the JMap.java file, and start reading. 如果您想了解这些细节,请下载OpenJDK源代码(选择任何版本),找到JMap.java文件,然后开始阅读。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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