Allocate a memory block of a specific type.
void *AllocMem( int32 s, uint32 t )
This macro allocates a memory block of a specific type.
One of the following flags must be set:
If a block of VRAM must come from a specific VRAM bank, the following flag must be set:
The following flags are provided for compatibility with future hardware. You can set them in addition to the preceding flags.
The following flags specify alignment, fill, and other allocation characteristics:
MEMTYPE_INPAGE
Allocate a memory block that does not cross page boundaries.
The procedure returns a pointer to the memory block that was allocated or NULL if the memory couldn't be allocated.
Macro implemented in mem.h V20.
Use FreeMem()
to free a block of memory that was allocated with AllocMem()
.
If there is insufficient memory in a task's free memory pool to allocate the requested memory, the kernel automatically transfers the necessary pages of additional memory from the system-wide free memory pool to the task's free memory pool. The only exceptions are (1) when there is not enough memory in both pools together to satisfy the request, or (2) when the MEMTYPE_MYPOOL memory flag-which specifies that the memory block must be allocated only from the task's free memory pool-is set.
You can enable memory debugging in your application by compiling your entire project with the MEMDEBUG value defined on the compiler's command-line. Refer to the CreateMemDebug()
function for more details.
AllocMemBlocks
(), AllocMemFromMemList(), AllocMemList(), ControlMem(), FreeMem(), FreeMemList(), FreeMemToMemList(), malloc(), ScavengeMem(),