简体   繁体   English

对JVM进行性能分析:已提交,已使用,已释放内存

[英]Profiling JVM: Committed vs Used vs free Memory

I'm profiling a Java application deployed to Jetty server, using JProfiler. 我正在使用JProfiler对部署到Jetty服务器的Java应用程序进行性能分析。

After a while, I'm getting this memory telemetry: 一段时间后,我得到了该内存遥测: 在此处输入图片说明

On the right side is the total memory of this Java process on Windows Task Manager. 右侧是Windows Task Manager上此Java进程的总内存。

  1. I see periodic increases in the Committed Memory in JProfiler, although most of the time, most of this memory is Free (Green). 我看到JProfiler中的Committed Memory定期增加,尽管在大多数情况下,该内存中的大部分都是Free(绿色)。 Why is the committed memory increased like this? 为什么提交的内存会像这样增加?
  2. In the time point when the image above was taken, the Committed Memory in JProfiler shows 3.17GB but Windows Task Manager shows much higher - 4.2457 GB. 在拍摄上图的时间点中,JProfiler中的“承诺的内存”显示为3.17GB,但Windows Task Manager显示的要高得多-4.2457 GB。 Isn't it the same memory they both show? 两者都显示出相同的记忆吗? What might be the reason for this difference? 造成这种差异的原因可能是什么?

If the peak memory usage approaches the total committed memory size, the JVM will increase the committed memory (the memory that has actually been reserved by the OS for the process) as long as your -Xmx value allows it. 如果峰值内存使用量接近总的承诺内存大小,则只要您的-Xmx值允许,JVM就会增加承诺的内存(操作系统实际上已为该进程保留的内存)。

This is a little like filling an ArrayList. 这有点像填充ArrayList。 When the backing array is exhausted, it's enlarged in larger and larger steps, so that it does not have to be resized for each insert. 当背衬阵列用尽时,它会以越来越大的步伐扩大,因此不必为每个插入物调整大小。

As for the difference between the task manager and the heap size of the JVM, the memory in the task manager is always larger than the heap size and is generally difficult to interpret. 至于任务管理器和JVM的堆大小之间的差异,任务管理器中的内存总是大于堆大小,并且通常很难解释。 See here for an explanation of the different measures: 请参阅此处以了解不同措施的说明:

https://technet.microsoft.com/en-us/library/ff382715.aspx https://technet.microsoft.com/zh-CN/library/ff382715.aspx

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

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