Function MemHeader.allocateAbs

allocateAbs -- Allocate absolute or aligned memory chunk from MemHeader managed memory

void* allocateAbs (
  ulong byteSize,
  void* location,
  MemFlags flags = MemFlags.Any
);

Allocates absolute or aligned memory from the given MemHeader.

All blocks, whether free or allocated, will be block aligned; hence, all allocation sizes are rounded up to the next block even value (e.g. the minimum allocation resolution is MEM_BLOCKSIZE bytes. A request for MEM_BLOCKSIZE bytes will use up exactly MEM_BLOCKSIZE bytes. A request for MEM_BLOCKSIZE-1 bytes will also use up exactly MEM_BLOCKSIZE bytes.).

This function can be used to manage an application's internal data memory. Note that no arbitration of the MemHeader and associated free chunk list is done. You must be the owner before calling Allocate.

This function will allocate accordingly to your MEMF_#? flags.

Parameters

NameDescription
byteSize requested byte size. The size is rounded up to the next MEM_BLOCKSIZE boundary.
location Location of absolute chunk to allocate or alignment value for aligned allocations ( 0 < x < (void*).sizeof * 8 ). E.g. 4k alignment = 2^12 . x = 12
flags flags to use for allocation

Returns

null on failure, or the pointer to your allocated memory. The memory is aligned to MEM_BLOCKSIZE boundaries.

Notes

No access abitration is done here. SysBase may be null.

See

initMemHeader(), addMemHeader(), remMemHeader(), Allocate(), deallocate()