摘要: 主要思路 就是先获取当前占用内存(usedMemory) 然后创建对象 再获取当前占用内存 两次内存差就是该对象所占内存大小 runGC()方法提供垃圾回收在每次获取内存前可以先调用private static final Runtime s_runtime = Runtime.getRuntime();private static void runGC() throws Exception {// It helps to call Runtime.gc()// using several method calls:for (int r = 0; r < 4; ++r)_runGC(); 阅读全文
posted @ 2014-03-19 10:52 你猜呢 阅读(511) 评论(0) 推荐(0) 编辑