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; } } } }
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; } } } }
return; if (trackedObjects.decrementAndGet(object) == 0) {
return; if (trackedObjects.decrementAndGet(object) == 0) {