Example usage for java.lang.management MemoryPoolMXBean resetPeakUsage

List of usage examples for java.lang.management MemoryPoolMXBean resetPeakUsage

Introduction

In this page you can find the example usage for java.lang.management MemoryPoolMXBean resetPeakUsage.

Prototype

public void resetPeakUsage();

Source Link

Document

Resets the peak memory usage statistic of this memory pool to the current memory usage.

Usage

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;
}