presto-orc/src/main/java/io/prestosql/orc/ChunkedSliceOutput.java/ChunkedSliceOutput/closeChunk
class ChunkedSliceOutput:    private void closeChunk()
    {
        // add trimmed view of slice to closed slices
        closedSlices.add(slice.slice(0, bufferPosition));
        closedSlicesRetainedSize += slice.getRetainedSize();

        // create a new buffer
        // double size until we hit the max chunk size
        buffer = chunkSupplier.get();
        slice = Slices.wrappedBuffer(buffer);

        streamOffset += bufferPosition;
        bufferPosition = 0;
    }