presto-array/src/main/java/io/prestosql/array/SliceBigArray.java/SliceBigArray/updateRetainedSize
class SliceBigArray:    private void updateRetainedSize(long index, Slice value)
    {
        Slice currentValue = array.get(index);
        if (currentValue != null) {
            int baseReferenceCount = trackedSlices.decrementAndGet(currentValue.getBase());
            int sliceReferenceCount = trackedSlices.decrementAndGet(currentValue);
            if (baseReferenceCount == 0) {
                // it is the last referenced base
                sizeOfSlices -= currentValue.getRetainedSize();
            }
            else if (sliceReferenceCount == 0) {
                // it is the last referenced slice
                sizeOfSlices -= SLICE_INSTANCE_SIZE;
            }
        }
        if (value != null) {
            int baseReferenceCount = trackedSlices.incrementAndGet(value.getBase());
            int sliceReferenceCount = trackedSlices.incrementAndGet(value);
            if (baseReferenceCount == 1) {
                // it is the first referenced base
                sizeOfSlices += value.getRetainedSize();
            }
            else if (sliceReferenceCount == 1) {
                // it is the first referenced slice
                sizeOfSlices += SLICE_INSTANCE_SIZE;
            }
        }
    }