@Override public long getRetainedSizeInBytes() { return INSTANCE_SIZE + value.getRetainedSizeInBytes(); }
@Override public long getRetainedSizeInBytes() { return INSTANCE_SIZE + block.getRetainedSizeInBytes(); }
@Override public long getRetainedSizeInBytes() { return INSTANCE_SIZE + block.getRetainedSizeInBytes(); }
@Override public long getRetainedSizeInBytes() { return INSTANCE_SIZE + keyBlock.getRetainedSizeInBytes() + valueBlock.getRetainedSizeInBytes() + sizeOf(hashTable); }
@Override public void retainedBytesForEachPart(BiConsumer<Object, Long> consumer) { consumer.accept(block, block.getRetainedSizeInBytes()); consumer.accept(this, (long) INSTANCE_SIZE); }
@Override public void retainedBytesForEachPart(BiConsumer<Object, Long> consumer) { consumer.accept(block, block.getRetainedSizeInBytes()); consumer.accept(this, (long) INSTANCE_SIZE); }
@Override public void retainedBytesForEachPart(BiConsumer<Object, Long> consumer) { consumer.accept(value, value.getRetainedSizeInBytes()); consumer.accept(this, (long) INSTANCE_SIZE); }
@Override public void retainedBytesForEachPart(BiConsumer<Object, Long> consumer) { for (Block fieldBlock : fieldBlocks) { consumer.accept(fieldBlock, fieldBlock.getRetainedSizeInBytes()); } consumer.accept(this, (long) INSTANCE_SIZE); }
@Override public void retainedBytesForEachPart(BiConsumer<Object, Long> consumer) { consumer.accept(keyBlock, keyBlock.getRetainedSizeInBytes()); consumer.accept(valueBlock, valueBlock.getRetainedSizeInBytes()); consumer.accept(hashTable, sizeOf(hashTable)); consumer.accept(this, (long) INSTANCE_SIZE); }
@Override public long getRetainedSizeInBytes() { assureLoaded(); return INSTANCE_SIZE + block.getRetainedSizeInBytes(); }
@Override public void retainedBytesForEachPart(BiConsumer<Object, Long> consumer) { consumer.accept(dictionary, dictionary.getRetainedSizeInBytes()); consumer.accept(ids, sizeOf(ids)); consumer.accept(this, (long) INSTANCE_SIZE); }
@Override public long getRetainedSizeInBytes() { long retainedSizeInBytes = INSTANCE_SIZE; for (int i = 0; i < fieldBlocks.length; i++) { retainedSizeInBytes += getRawFieldBlock(i).getRetainedSizeInBytes(); } return retainedSizeInBytes; }
private void updateRetainedSize() { long retainedSizeInBytes = INSTANCE_SIZE + sizeOf(blocks); for (Block block : blocks) { retainedSizeInBytes += block.getRetainedSizeInBytes(); } this.retainedSizeInBytes.set(retainedSizeInBytes); }
@Override public void retainedBytesForEachPart(BiConsumer<Object, Long> consumer) { consumer.accept(keyBlock, keyBlock.getRetainedSizeInBytes()); consumer.accept(valueBlock, valueBlock.getRetainedSizeInBytes()); consumer.accept(offsets, sizeOf(offsets)); consumer.accept(mapIsNull, sizeOf(mapIsNull)); consumer.accept(hashTables, sizeOf(hashTables)); consumer.accept(this, (long) INSTANCE_SIZE); }
@Override public void retainedBytesForEachPart(BiConsumer<Object, Long> consumer) { for (int i = 0; i < numFields; i++) { consumer.accept(fieldBlocks[i], fieldBlocks[i].getRetainedSizeInBytes()); } consumer.accept(fieldBlockOffsets, sizeOf(fieldBlockOffsets)); consumer.accept(rowIsNull, sizeOf(rowIsNull)); consumer.accept(this, (long) INSTANCE_SIZE); }
@Override public void retainedBytesForEachPart(BiConsumer<Object, Long> consumer) { consumer.accept(values, values.getRetainedSizeInBytes()); consumer.accept(offsets, sizeOf(offsets)); consumer.accept(valueIsNull, sizeOf(valueIsNull)); consumer.accept(this, (long) INSTANCE_SIZE); }
/** * Use createArrayBlockInternal or fromElementBlock instead of this method. The caller of this method is assumed to have * validated the arguments with validateConstructorArguments. */ private ArrayBlock(int arrayOffset, int positionCount, @Nullable boolean[] valueIsNull, int[] offsets, Block values) { // caller must check arguments with validateConstructorArguments this.arrayOffset = arrayOffset; this.positionCount = positionCount; this.valueIsNull = valueIsNull; this.offsets = offsets; this.values = requireNonNull(values); sizeInBytes = -1; retainedSizeInBytes = INSTANCE_SIZE + values.getRetainedSizeInBytes() + sizeOf(offsets) + sizeOf(valueIsNull); }
/** * Use createRowBlockInternal or fromFieldBlocks instead of this method. The caller of this method is assumed to have * validated the arguments with validateConstructorArguments. */ private RowBlock(int startOffset, int positionCount, @Nullable boolean[] rowIsNull, int[] fieldBlockOffsets, Block[] fieldBlocks) { super(fieldBlocks.length); this.startOffset = startOffset; this.positionCount = positionCount; this.rowIsNull = rowIsNull; this.fieldBlockOffsets = fieldBlockOffsets; this.fieldBlocks = fieldBlocks; this.sizeInBytes = -1; long retainedSizeInBytes = INSTANCE_SIZE + sizeOf(fieldBlockOffsets) + sizeOf(rowIsNull); for (Block fieldBlock : fieldBlocks) { retainedSizeInBytes += fieldBlock.getRetainedSizeInBytes(); } this.retainedSizeInBytes = retainedSizeInBytes; }
public void compact() { if (eagerCompact) { return; } for (int channel = 0; channel < types.size(); channel++) { ObjectArrayList<Block> blocks = channels[channel]; for (int i = nextBlockToCompact; i < blocks.size(); i++) { Block block = blocks.get(i); // Copy the block to compact its size Block compactedBlock = block.copyRegion(0, block.getPositionCount()); blocks.set(i, compactedBlock); pagesMemorySize -= block.getRetainedSizeInBytes(); pagesMemorySize += compactedBlock.getRetainedSizeInBytes(); } } nextBlockToCompact = channels[0].size(); estimatedSize = calculateEstimatedSize(); }
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); } }