void free() { UnsafeUtil.free( address, limit - address, memoryTracker ); }
@Override public void close() { UnsafeUtil.free( allocatedAddress, allocatedBytes, allocationTracker ); }
@Override public void close() { if ( !closed ) { if ( length > 0 ) { // Allocating 0 bytes actually returns address 0 UnsafeUtil.free( allocatedAddress, allocatedBytes, allocationTracker ); } closed = true; } } }
@Override public void release() { released = true; final List<MemoryBlock> blocks = new ArrayList<>(); for ( final BlockingQueue<MemoryBlock> cache : caches ) { cache.drainTo( blocks ); blocks.forEach( block -> UnsafeUtil.free( block.unalignedAddr, block.unalignedSize ) ); blocks.clear(); } }
/** * Free the memory that was allocated with {@link #allocateMemory} and update memory allocation tracker accordingly. */ public static void free( long pointer, long bytes, MemoryAllocationTracker allocationTracker ) { free( pointer, bytes ); allocationTracker.deallocated( bytes ); }
@VisibleForTesting void doFree( MemoryBlock block, MemoryAllocationTracker tracker ) { UnsafeUtil.free( block.unalignedAddr, block.unalignedSize, tracker ); }
@AfterAll static void cleanup() { executor.shutdown(); UnsafeUtil.free( lockAddr, Long.BYTES, GlobalMemoryTracker.INSTANCE ); }
@Override public void clear() { if ( isByteUniform( defaultValue ) ) { UnsafeUtil.setMemory( address, length * itemSize, defaultValue[0] ); } else { long intermediary = UnsafeUtil.allocateMemory( itemSize, allocationTracker ); for ( int i = 0; i < defaultValue.length; i++ ) { UnsafeUtil.putByte( intermediary + i, defaultValue[i] ); } for ( long i = 0, adr = address; i < length; i++, adr += itemSize ) { UnsafeUtil.copyMemory( intermediary, adr, itemSize ); } UnsafeUtil.free( intermediary, itemSize, allocationTracker ); } }
free( address, sizeInBytes, GlobalMemoryTracker.INSTANCE );
@Override public void close() { UnsafeUtil.free( allocatedAddress, allocatedBytes, allocationTracker ); }
@Override public void close() { UnsafeUtil.free( allocatedAddress, allocatedBytes, allocationTracker ); }
@Override public void close() { if ( !closed ) { if ( length > 0 ) { // Allocating 0 bytes actually returns address 0 UnsafeUtil.free( allocatedAddress, allocatedBytes, allocationTracker ); } closed = true; } } }
void free() { UnsafeUtil.free( address, limit - address, memoryTracker ); }
@Override public void release() { released = true; final List<MemoryBlock> blocks = new ArrayList<>(); for ( final BlockingQueue<MemoryBlock> cache : caches ) { cache.drainTo( blocks ); blocks.forEach( block -> UnsafeUtil.free( block.unalignedAddr, block.unalignedSize ) ); blocks.clear(); } }
/** * Free the memory that was allocated with {@link #allocateMemory} and update memory allocation tracker accordingly. */ public static void free( long pointer, long bytes, MemoryAllocationTracker allocationTracker ) { free( pointer, bytes ); allocationTracker.deallocated( bytes ); }
@VisibleForTesting void doFree( MemoryBlock block, MemoryAllocationTracker tracker ) { UnsafeUtil.free( block.unalignedAddr, block.unalignedSize, tracker ); }
@Override public void clear() { if ( isByteUniform( defaultValue ) ) { UnsafeUtil.setMemory( address, length * itemSize, defaultValue[0] ); } else { long intermediary = UnsafeUtil.allocateMemory( itemSize, allocationTracker ); for ( int i = 0; i < defaultValue.length; i++ ) { UnsafeUtil.putByte( intermediary + i, defaultValue[i] ); } for ( long i = 0, adr = address; i < length; i++, adr += itemSize ) { UnsafeUtil.copyMemory( intermediary, adr, itemSize ); } UnsafeUtil.free( intermediary, itemSize, allocationTracker ); } }