查看JVM的内存使用

Runtime lRuntime = Runtime.getRuntime();

out.println("Free  Memory: "+lRuntime.freeMemory()/1024/1024+"M");  //已分配的空间中未被使用的部分

out.println("Max   Memory: "+lRuntime.maxMemory()/1024/1024+"M"); //最大可分配的空间

out.println("Total Memory: "+lRuntime.totalMemory()/1024/1024+"M"); //已分配的空间

Leave a Reply

Your email address will not be published. Required fields are marked *