Method | Description | |
---|---|---|
Free ( IMemoryBlock allocatedBlock ) : void |
Frees an allocated memory block. This method does not verify if the allocatedBlock is indeed from this slab. Callers should make sure that the allocatedblock belongs to the right slab. |
|
TryAllocate ( long length, IMemoryBlock &allocatedBlock ) : bool |
Attempts to allocate a memory block of a specified length.
|
|
TryAllocate ( long minLength, long maxLength, IMemoryBlock &allocatedBlock ) : long |
Attempts to allocate a memory block of length between minLength and maxLength (both inclusive) This overload is useful when multiple threads are concurrently working on the slab and the caller wants to allocate a block up to a desired size |
Method | Description | |
---|---|---|
AddFreeBlock ( long offset, long length, bool suppressSetLargest ) : void |
Marks an allocated block as unallocated Set suppressSetLargest when the caller will the LargestFreeBlockSize after this method is called |
|
GetLargest ( ) : long | ||
MemorySlab ( long size, |
Initializes a new instance of the MemorySlab class
|
|
RemoveFreeBlock ( FreeSpace block, bool suppressSetLargest ) : void |
Marks an unallocated contiguous block as allocated Set suppressSetLargest when the caller will the LargestFreeBlockSize after this method is called |
|
SetLargest ( long value ) : void |
Sets a new value as the largest unallocated contiguous block size
|
|
ShrinkFreeMemoryBlock ( FreeSpace block, long shrinkTo ) : void |
Marks an unallocated contiguous block as allocated, and then marks an allocated block as unallocated
|
|
ShrinkOrRemoveFreeMemoryBlock ( FreeSpace block, long shrinkTo, bool suppressSetLargest ) : void |
Marks an unallocated contiguous block as allocated, and then marks an allocated block as unallocated Set suppressSetLargest when the caller will the LargestFreeBlockSize after this method is calledDo not call this method directly, instead call ShrinkFreeMemoryBlock() or the FreeMemoryBlock() |
public Free ( IMemoryBlock allocatedBlock ) : void | ||
allocatedBlock | IMemoryBlock | Allocated memory block to be freed |
return | void |
public TryAllocate ( long length, IMemoryBlock &allocatedBlock ) : bool | ||
length | long | Length, in bytes, of memory block |
allocatedBlock | IMemoryBlock | Allocated memory block |
return | bool |
public TryAllocate ( long minLength, long maxLength, IMemoryBlock &allocatedBlock ) : long | ||
minLength | long | The minimum acceptable length |
maxLength | long | The maximum acceptable length |
allocatedBlock | IMemoryBlock | Allocated memory block |
return | long |