gpt4 book ai didi

java - 已用、已提交和最大堆内存的差异

转载 作者:IT老高 更新时间:2023-10-28 21:06:42 24 4
gpt4 key购买 nike

我正在监视 OutOfMemoryException 的 spark executor JVM。我使用 Jconsole 连接到执行程序 JVM。以下是 Jconsole 的快照: enter image description here

图中已用内存显示为 3.8G,已提交内存为 8.6G,Max memory 也为 8.6G谁能解释已用内存和已提交内存之间的区别或任何解释它的链接。

最佳答案

来自 MemoryUsage 的 Java 文档,

getUsed 是:

the amount of used memory in bytes

getCommitted()

Returns the amount of memory in bytes that is committed for the Java virtual machine to use. This amount of memory is guaranteed for the Java virtual machine to use.

getMax()

Returns the maximum amount of memory in bytes that can be used for memory management. This method returns -1 if the maximum memory size is undefined.

This amount of memory is not guaranteed to be available for memory management if it is greater than the amount of committed memory. The Java virtual machine may fail to allocate memory even if the amount of used memory does not exceed this maximum size.

关于java - 已用、已提交和最大堆内存的差异,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41468670/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com