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");
}
1万+

被折叠的 条评论
为什么被折叠?



