List of usage examples for java.lang.management MemoryPoolMXBean resetPeakUsage
public void resetPeakUsage();
From source file:org.carrot2.core.benchmarks.memtime.MemTimeBenchmark.java
/** * Return the peak number of bytes used (all memory pools) and reset the peak usage. */// ww w .j a v a2 s .co m private static long memPeak() { long peak = 0; for (MemoryPoolMXBean b : ManagementFactory.getMemoryPoolMXBeans()) { peak += b.getPeakUsage().getUsed(); b.resetPeakUsage(); } return peak; }