美文网首页
JAVA 虚拟机可用内存

JAVA 虚拟机可用内存

作者: 卜卜Bruce | 来源:发表于2018-09-18 14:58 被阅读0次

Total designated memory, this will equal the configured -Xmx value:

Runtime.getRuntime().maxMemory();

Current allocated free memory, is the current allocated space ready for new objects. Caution this is not the total free available memory:

Runtime.getRuntime().freeMemory();

Total allocated memory, is the total allocated space reserved for the java process:

Runtime.getRuntime().totalMemory();

Used memory, has to be calculated:

usedMemory = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();

Total free memory, has to be calculated:

freeMemory = Runtime.getRuntime().maxMemory() - usedMemory;

相关文章

网友评论

      本文标题:JAVA 虚拟机可用内存

      本文链接:https://www.haomeiwen.com/subject/rufpnftx.html