在目标代码前放置
Runtime r = Runtime.getRuntime(); r.gc(); long startMem = r.freeMemory(); // 开始时的剩余内存
目标代码执行后
long orz = startMem - r.freeMemory(); // 剩余内存 现在 System.out.println("current mem: " + orz);
在目标代码前放置
Runtime r = Runtime.getRuntime(); r.gc(); long startMem = r.freeMemory(); // 开始时的剩余内存
目标代码执行后
long orz = startMem - r.freeMemory(); // 剩余内存 现在 System.out.println("current mem: " + orz);