 |
Memory Manager
|
The AMX Memory Manager controls the dynamic allocation of memory to tasks in the multitasking environment. Multiple sections of user defined memory can be controlled by the Memory Manager. The memory in each section must be contiguous. Sections do not have to be contiguous.
Memory sections are combined to form memory pools from which variable sized blocks of memory can be allocated.
A particularly unique feature of the Memory Manager permits any block of memory (including those acquired from the Memory Manager) to be treated as a section of a memory pool from which smaller private blocks can be dynamically allocated.
A task can request the Memory Manager to allocate a contiguous block of memory of any size from a specific memory pool. When finished with the block, the task requests the Memory Manager to free the memory block for use by other tasks. When released, the memory block is automatically returned by the Memory Manager to the memory pool to which the memory block belongs. Memory block ownership can be increased so that more than one task can simultaneously own a shared memory block. Special facilities are provided to assure that if a memory block is owned by more than one task, it is only returned to its pool when the slowest owner finally releases it.
The AMX Memory Manager can be used to replace the non-reentrant malloc() and free() functions commonly found in most single-tasking C runtime libraries.
|
Memory Manager |
| Function |
Service |
| cjmmcreate |
Create a memory pool |
| cjmmdelete |
Delete a memory pool |
| cjmmget |
Get a block of memory from a specific memory pool |
| cjmmfree |
Free a block of memory |
| cjmmsize |
Get size of a block of memory |
| cjmmresize |
Resize (grow or shrink) a block of memory |
| cjmmuse |
Add to a memory block's use count |
| cjmmstatus |
Get status of a memory pool |
|
|