Méthode | Description | |
---|---|---|
Allocate ( ulong id, long size, long &outputStart ) : bool |
Attempts to allocate a range of memory.
|
|
Allocator ( long memoryPoolSize, BufferPool |
Creates a new memory pool.
|
|
CanFit ( long size, QuickList |
Checks if a block of memory can fit into the current state of the allocator.
|
|
Deallocate ( ulong id ) : bool |
Removes the memory associated with the id from the pool.
|
|
GetLargestContiguousSize ( long &largestContiguous, long &totalFreeSpace ) : void |
Gets the size of the largest contiguous area and the total free space in the allocator. Not very efficient; runs in linear time for the number of allocations.
|
|
IncrementalCompact ( ulong &id, long &size, long &oldStart, long &newStart ) : bool |
Finds the first allocation with empty space before it and pulls it forward to close the gap. Assumes the ability to perform synchronous reallocation.
|
|
Resize ( ulong id, long size, long &oldStart, long &newStart ) : bool |
Attempts to resize a given allocation to a new size. If the new size is smaller, the start index remains unchanged.
|
|
TryGetAllocationRegion ( ulong allocationId, Allocation &allocation ) : bool |
Gets the allocation region associated with the given allocation id if it is present.
|
Méthode | Description | |
---|---|---|
AddAllocation ( ulong id, long start, long end, Allocation &allocation, Allocation &nextAllocation ) : void | ||
Contains ( ulong id ) : bool | ||
ValidatePointers ( ) : void |
public Allocate ( ulong id, long size, long &outputStart ) : bool | ||
id | ulong | Unique id of the memory to allocate. |
size | long | Size of the memory to allocate. |
outputStart | long | Starting index of the allocated memory, if successful. |
Résultat | bool |
public Allocator ( long memoryPoolSize, BufferPool |
||
memoryPoolSize | long | Size of the pool in elements. |
idBufferPool | BufferPool |
Buffer pool to use in the allocator. If null, the allocator picks. |
allocationBufferPool | BufferPool |
Buffer pool to use in the allocator. If null, the allocator picks. |
tableBufferPool | BufferPool |
Buffer pool to use in the allocator. If null, the allocator picks. |
Résultat | System |
public CanFit ( long size, QuickList |
||
size | long | Size of the memory to test. |
ignoredIds | QuickList |
Ids of allocations to treat as nonexistent for the purposes of the test. |
Résultat | bool |
public Deallocate ( ulong id ) : bool | ||
id | ulong | Id to remove. |
Résultat | bool |
public GetLargestContiguousSize ( long &largestContiguous, long &totalFreeSpace ) : void | ||
largestContiguous | long | Largest contiguous region in the allocator. The allocator can hold an allocation up to this size. |
totalFreeSpace | long | Total free space in the allocator. |
Résultat | void |
public IncrementalCompact ( ulong &id, long &size, long &oldStart, long &newStart ) : bool | ||
id | ulong | Id of the allocation to be moved, if any. |
size | long | Size of the moved allocation. |
oldStart | long | Old starting location of the allocation. |
newStart | long | New starting location of the allocation. |
Résultat | bool |
public Resize ( ulong id, long size, long &oldStart, long &newStart ) : bool | ||
id | ulong | Id of the allocation to resize. |
size | long | New desired size of the allocation. |
oldStart | long | Old start location of the allocation. |
newStart | long | New start location of the allocation. |
Résultat | bool |
public TryGetAllocationRegion ( ulong allocationId, Allocation &allocation ) : bool | ||
allocationId | ulong | Allocation id to look up the allocation for. |
allocation | Allocation | Allocation associated with the id, if present. |
Résultat | bool |