private int doConsumeOffHeapMemory(final int allocationSize) {
    int i = 0;

    // Loop until we fail
    try {
      Stopwatch stopwatch = Stopwatch.createStarted();
      while (stopwatch.elapsed(MINUTES) < 2) {
        doPut("KEY" + (i++), new byte[allocationSize], OFF_HEAP_REGION_NAME, false);
      }
    } catch (OutOfOffHeapMemoryException ignored) {
    }

    return i;
  }
Consumes off off-heap memory until the allocation size cannot be satisfied.

@param allocationSize the number of bytes for each allocation

@return the number of successful puts
geode-core/src/distributedTest/java/org/apache/geode/management/OffHeapManagementDUnitTest.java