public static void test(){ for (int j = 0; j < 100000; j++) { Object o = new Object(); } System.out.println("总内存:" + Runtime.getRuntime().totalMemory() / 1024 / 1024 + "M"); System.out.println("空闲内存:" + Runtime.getRuntime().freeMemory() / 1024 / 1024 + "M"); System.out.println("已使用内存:" + (Runtime.getRuntime().totalMemory() - Runtime .getRuntime().freeMemory()) / 1024 / 1024 + "M"); }
检测运行内存
猜你喜欢
转载自jameskaron.iteye.com/blog/2354800
今日推荐
周排行