private void reuse(OutOfOffHeapMemoryListener oooml, OffHeapMemoryStats newStats,
      long offHeapMemorySize, Slab[] slabs) {
    if (isClosed()) {
      throw new IllegalStateException("Can not reuse a closed off-heap memory manager.");
    }
    if (oooml == null) {
      throw new IllegalArgumentException("OutOfOffHeapMemoryListener is null");
    }
    if (getTotalMemory() != offHeapMemorySize) {
      logger.warn("Using {} bytes of existing off-heap memory instead of the requested {}.",
          getTotalMemory(), offHeapMemorySize);
    }
    if (!freeList.okToReuse(slabs)) {
      throw new IllegalStateException(
          "attempted to reuse existing off-heap memory even though new off-heap memory was allocated");
    }
    ooohml = oooml;
    newStats.initialize(stats);
    stats = newStats;
  }
This allocator is somewhat like an Arena allocator. We start out with an array of multiple large
chunks of memory. We also keep lists of any chunk that have been allocated and freed. An
allocation will always try to find a chunk in a free list that is a close fit to the requested
size. If no close fits exist then it allocates the next slice from the front of one the original
large chunks. If we can not find enough free memory then all the existing free memory is
defragmented. If we still do not have enough to make the allocation an exception is thrown.

@since Geode 1.0
geode-core/src/main/java/org/apache/geode/internal/offheap/MemoryAllocatorImpl.java