Interface ISessionMemoryAllocator
Allocates and frees blocks within an execution session's memory space, and reports allocation and fragmentation statistics.
public interface ISessionMemoryAllocator
Remarks
⚖️RDCore provides an implementation of this interface licensed under GPLv3.
Properties
Info
Current allocation and fragmentation statistics for this session's memory space.
SessionMemoryInfo Info { get; }
Property Value
Methods
TryAllocate(int, out MemoryAddress)
Allocates the specified number of bytes in the memory space of this session.
bool TryAllocate(int size, out MemoryAddress address)
Parameters
sizeintThe desired size of the allocation.
addressMemoryAddressThe start of the allocated address space.
Returns
- bool
trueif the specified number of bytes can be allocated,falseotherwise.
TryDeallocate(MemoryAddress, out SessionMemoryBlock)
Frees the block starting at address.
bool TryDeallocate(MemoryAddress address, out SessionMemoryBlock block)
Parameters
addressMemoryAddressblockSessionMemoryBlock
Returns
TryFindBlock(MemoryAddress, out SessionMemoryBlock)
Finds the allocated block that address falls inside — the first byte of one,
or any byte within it.
bool TryFindBlock(MemoryAddress address, out SessionMemoryBlock block)
Parameters
addressMemoryAddressAny address, allocated or not.
blockSessionMemoryBlockThe block containing it.
Returns
- bool
falseif nothing is allocated at that address.
Remarks
Allocation is the only thing that knows how big anything is, so it is the only thing that can answer "what lives at this address". Direct byte-level access to a session's memory needs that answer; nothing else does.