in src/main/java/org/apache/datasketches/memory/DefaultMemoryRequestServer.java [123:138]
public WritableMemory request(
final WritableMemory oldWmem,
final long newCapacityBytes) {
//On-heap
if (oldWmem.getArena() == null || !offHeap) {
if (newCapacityBytes > Integer.MAX_VALUE) {
throw new IllegalArgumentException("Requested capacity exceeds Integer.MAX_VALUE.");
}
return WritableMemory.allocate((int)newCapacityBytes, byteOrder, this);
}
//Acquire Arena
final Arena arena = (oneArena) ? oldWmem.getArena() : Arena.ofConfined();
return WritableMemory.allocateDirect(newCapacityBytes, alignmentBytes, byteOrder, this, arena);
}