📜  java get ram 用法 - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:30.163000             🧑  作者: Mango

代码示例1
MemoryUsage heapMemoryUsage = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage();
long maxMB = heapMemoryUsage.getMax()/(1024*1024);
long usedMB = heapMemoryUsage.getUsed()/(1024*1024);