public static boolean isMemEnough() {
Runtime run = Runtime.getRuntime();
long max = run.maxMemory() / 1024 / 1024;
long used = (run.totalMemory() - run.freeMemory()) / 1024 / 1024;
int percent = (int) ((double) used / (double) max * 100);
String lpercent = ReadPropertiesUtil.get("mem_percent");
return percent < Integer.parseInt(lpercent);
}
统计java内存使用率代码
最新推荐文章于 2022-11-14 17:08:01 发布