/** * 获取系统内存使用情况 * * @return 包含最大内存, 使用内存, 剩余内存的map对象 */ @Override public Map getXtncSyqk() { Map map = new HashMap(); long maxMem = Runtime.getRuntime().maxMemory()/1024/1024; long freeMem = Runtime.getRuntime().freeMemory()/1024/1024; long usedMem = maxMem - freeMem; map.put("MaxMemory", maxMem + "MB"); map.put("UsedMemory", usedMem + "MB"); map.put("FreeMemory", freeMem + "MB"); return map; }
java获取运行时虚拟机内存情况,布布扣,bubuko.com
原文地址:http://blog.csdn.net/w_basketboy24/article/details/25403749