/** * Stop tracing the insert(), and release any buffers that were allocated */ public void traceEnd() { traceBuf.release(); traceBuf = null; traceBufNext = 0; }
@Override public synchronized void close() { if(buf != null){ buf.release(); buf = null; } }
public void clearBuffers() { if (pageData != null) { pageData.release(); pageData = null; } }
@Override public boolean apply(long key, ArrowBuf value) { value.release(); return true; } });
public void close() { if (body != null) { body.release(); } }
@Override public void close() { if(buf != null){ buf.release(); buf = null; } } }
/** * Stop tracing the insert(), and release any buffers that were allocated */ public void traceEnd() { traceBuf.release(); traceBuf = null; traceBufNext = 0; }
@Override public synchronized void close() { if(buf != null){ buf.release(); buf = null; } }
@Override public void clear() { // Releasing any remaining direct buffers that were not released due to errors. for (ArrowBuf buf : directBufMap.values()) { buf.release(); } }
public void release() { if (!released.compareAndSet(false, true)) { throw new IllegalStateException("QueryDataBatch was released twice."); } if (data != null) { data.release(1); } }
public void clear() { dataBuffer.release(); dataBuffer = allocator.getEmpty(); valueCount = 0; }
@Override public void loadFieldBuffers(ArrowFieldNode fieldNode, List<ArrowBuf> ownBuffers) { if (ownBuffers.size() != 1) { throw new IllegalArgumentException("Illegal buffer count, expected " + 1 + ", got: " + ownBuffers.size()); } ArrowBuf bitBuffer = ownBuffers.get(0); validityBuffer.release(); validityBuffer = BitVectorHelper.loadValidityBuffer(fieldNode, bitBuffer, allocator); valueCount = fieldNode.getLength(); validityAllocationSizeInBytes = validityBuffer.capacity(); }
public void allocateNoClear(int count){ buf.release(); buf = allocator.buffer(count * blockWidth); resetPositions(); }
@Nullable @Override public ArrowBuf apply(@Nullable ArrowBuf buf) { int writerIndex = buf.writerIndex(); ArrowBuf newBuf = buf.transferOwnership(allocator).buffer; newBuf.writerIndex(writerIndex); buf.release(); return newBuf; } }).toList();
public ArrowBuf replace(ArrowBuf old, int newSize) { if (managedBuffers.remove(old.memoryAddress()) == null) { throw new IllegalStateException("Tried to remove unmanaged buffer."); } old.release(1); return getManagedBuffer(newSize); }
@Nullable @Override public ArrowBuf apply(@Nullable ArrowBuf buf) { int writerIndex = buf.writerIndex(); ArrowBuf newBuf = buf.transferOwnership(context.getAllocator()).buffer; newBuf.writerIndex(writerIndex); buf.release(); return newBuf; } }).toList();
@After public void after() { for (ArrowBuf buf : buffers) { buf.release(); } }
private void testReplaceUtf8Helper(byte[] in, byte replace, String expected) throws Exception { ByteBuf src = allocator.buffer(in.length + 1); ArrowBuf dest = allocator.buffer(in.length); src.writeByte(0x20); // one extra byte, just to test startIdx != 0 src.writeBytes(in); int destLen = StringFunctionUtil.copyReplaceUtf8(src, src.readerIndex() + 1, src.writerIndex(), dest, replace); assertSameAsExpected(expected, dest, destLen); src.release(); dest.release(); }
private void resizeBuffer(int sizeInBytes) { int targetSize = Numbers.nextPowerOfTwo(sizeInBytes); final ArrowBuf oldBuf = buf; buf = allocator.buffer(targetSize); PlatformDependent.copyMemory(oldBuf.memoryAddress(), buf.memoryAddress(), oldBuf.capacity()); buf.writerIndex(oldBuf.writerIndex()); oldBuf.release(); }
private void resizeBuffer(int newCapacity) { final int blockWidth = this.blockWidth; final int sizeInBytes = Numbers.nextPowerOfTwo(newCapacity * blockWidth); final ArrowBuf oldBuf = buf; buf = allocator.buffer(sizeInBytes); final int oldCapacity = this.capacity; fillZeros(buf.memoryAddress() + oldCapacity * blockWidth, (newCapacity - oldCapacity) * blockWidth); PlatformDependent.copyMemory(oldBuf.memoryAddress(), buf.memoryAddress(), oldCapacity * blockWidth); buf.writerIndex(oldBuf.writerIndex()); oldBuf.release(); this.capacity = newCapacity; }