boolean validateAddressAndSizeWithinSlab(long addr, int size) {
    for (final Slab slab : slabs) {
      if (slab.getMemoryAddress() <= addr
          && addr < (slab.getMemoryAddress() + slab.getSize())) {
        // validate addr + size is within the same slab
        if (size != -1) { // skip this check if size is -1
          if (!(slab.getMemoryAddress() <= (addr + size - 1)
              && (addr + size - 1) < (slab.getMemoryAddress() + slab.getSize()))) {
            throw new IllegalStateException(" address 0x" + Long.toString(addr + size - 1, 16)
                + " does not address the original slab memory");
          }
        }
        return true;
      }
    }
    return false;
  }
newSlabs will be non-null in unit tests. If the unit test gave us a different array of slabs
then something is wrong because we are trying to reuse the old already allocated array which
means that the new one will never be used. Note that this code does not bother comparing the
contents of the arrays.
geode-core/src/main/java/org/apache/geode/internal/offheap/FreeListManager.java