@Override public void retainedBytesForEachPart(BiConsumer<Object, Long> consumer) { assureLoaded(); block.retainedBytesForEachPart(consumer); consumer.accept(this, (long) INSTANCE_SIZE); }
currentValue.retainedBytesForEachPart((object, size) -> { if (currentValue == object) { value.retainedBytesForEachPart((object, size) -> { if (value == object) {
currentValue.retainedBytesForEachPart((object, size) -> { if (currentValue == object) { value.retainedBytesForEachPart((object, size) -> { if (value == object) {
private void updateRetainedSize() { // increment the size only when it is the first reference retainedSizeInBytes = Page.INSTANCE_SIZE + SizeOf.sizeOfObjectArray(page.getChannelCount()); ReferenceCountMap referenceCountMap = new ReferenceCountMap(); for (int channel = 0; channel < page.getChannelCount(); channel++) { Block block = page.getBlock(channel); if (!isNotLoadedLazyBlock(block)) { block.retainedBytesForEachPart((object, size) -> { if (referenceCountMap.incrementAndGet(object) == 1) { retainedSizeInBytes += size; } }); } } for (Block previouslyComputedResult : previouslyComputedResults) { if (previouslyComputedResult != null) { previouslyComputedResult.retainedBytesForEachPart((object, size) -> { if (referenceCountMap.incrementAndGet(object) == 1) { retainedSizeInBytes += size; } }); } } memoryContext.setBytes(retainedSizeInBytes); }
private void updateRetainedSize() { // increment the size only when it is the first reference retainedSizeInBytes = Page.INSTANCE_SIZE + SizeOf.sizeOfObjectArray(page.getChannelCount()); ReferenceCountMap referenceCountMap = new ReferenceCountMap(); for (int channel = 0; channel < page.getChannelCount(); channel++) { Block block = page.getBlock(channel); if (!isNotLoadedLazyBlock(block)) { block.retainedBytesForEachPart((object, size) -> { if (referenceCountMap.incrementAndGet(object) == 1) { retainedSizeInBytes += size; } }); } } for (Block previouslyComputedResult : previouslyComputedResults) { if (previouslyComputedResult != null) { previouslyComputedResult.retainedBytesForEachPart((object, size) -> { if (referenceCountMap.incrementAndGet(object) == 1) { retainedSizeInBytes += size; } }); } } memoryContext.setBytes(retainedSizeInBytes); }
private static void checkRetainedSize(Block block, boolean getRegionCreateNewObjects) { AtomicLong objectSize = new AtomicLong(); Object2LongOpenCustomHashMap<Object> trackedObjects = new Object2LongOpenCustomHashMap<>(new ObjectStrategy()); BiConsumer<Object, Long> consumer = (object, size) -> { objectSize.addAndGet(size); trackedObjects.addTo(object, 1); }; block.retainedBytesForEachPart(consumer); assertEquals(objectSize.get(), block.getRetainedSizeInBytes()); Block copyBlock = block.getRegion(0, block.getPositionCount() / 2); copyBlock.retainedBytesForEachPart(consumer); assertEquals(objectSize.get(), block.getRetainedSizeInBytes() + copyBlock.getRetainedSizeInBytes()); assertEquals(trackedObjects.getLong(block), 1); assertEquals(trackedObjects.getLong(copyBlock), 1); trackedObjects.remove(block); trackedObjects.remove(copyBlock); for (long value : trackedObjects.values()) { assertEquals(value, getRegionCreateNewObjects ? 1 : 2); } }
private static void checkRetainedSize(Block block, boolean getRegionCreateNewObjects) { AtomicLong objectSize = new AtomicLong(); Object2LongOpenCustomHashMap<Object> trackedObjects = new Object2LongOpenCustomHashMap<>(new ObjectStrategy()); BiConsumer<Object, Long> consumer = (object, size) -> { objectSize.addAndGet(size); trackedObjects.addTo(object, 1); }; block.retainedBytesForEachPart(consumer); assertEquals(objectSize.get(), block.getRetainedSizeInBytes()); Block copyBlock = block.getRegion(0, block.getPositionCount() / 2); copyBlock.retainedBytesForEachPart(consumer); assertEquals(objectSize.get(), block.getRetainedSizeInBytes() + copyBlock.getRetainedSizeInBytes()); assertEquals(trackedObjects.getLong(block), 1); assertEquals(trackedObjects.getLong(copyBlock), 1); trackedObjects.remove(block); trackedObjects.remove(copyBlock); for (long value : trackedObjects.values()) { assertEquals(value, getRegionCreateNewObjects ? 1 : 2); } }
block.getPositions(positions, 0, positions.length - 1).retainedBytesForEachPart((part, size) -> { if (part == positions) { isIdentical.set(true);
block.getPositions(positions, 0, positions.length - 1).retainedBytesForEachPart((part, size) -> { if (part == positions) { isIdentical.set(true);