/// <summary> /// Allocate a block of memory of the given size in bytes and update memory allocation tracker accordingly. /// <para> /// The memory is aligned such that it can be used for any data type. /// The memory is uninitialised, so it may contain random garbage, or it may not. /// </para> /// </summary> /// <returns> a pointer to the allocated memory </returns> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public static long allocateMemory(long bytes, org.neo4j.memory.MemoryAllocationTracker allocationTracker) throws NativeMemoryAllocationRefusedError public static long AllocateMemory(long bytes, MemoryAllocationTracker allocationTracker) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final long pointer = allocateMemory(bytes); long pointer = AllocateMemory(bytes); allocationTracker.Allocated(bytes); return(pointer); }
public override OffHeapBlockAllocator_MemoryBlock Allocate(long size, MemoryAllocationTracker tracker) { requirePositive(size); checkState(!_released, "Allocator is already released"); if (!IsCacheable(size)) { return(AllocateNew(size, tracker)); } //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final java.util.concurrent.BlockingQueue<OffHeapBlockAllocator_MemoryBlock> cache = caches[log2floor(size)]; BlockingQueue <OffHeapBlockAllocator_MemoryBlock> cache = _caches[log2floor(size)]; OffHeapBlockAllocator_MemoryBlock block = cache.poll(); if (block == null) { block = AllocateNew(size, tracker); } else { tracker.Allocated(block.UnalignedSize); } return(block); }