130
K
A
DAK
AMX Memory Manager
10.4 Private Memory Allocation
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 memory section
from which smaller private blocks can be dynamically allocated.
To use this feature, a task calls procedure ajmhan giving it a pointer to a private area of
memory whose access is to be controlled by the Memory Manager. Blocks allocated by
procedure ajmget or ajmgeh are suitable for this purpose. The caller must also specify
the size of the memory area provided.
The Memory Manager takes the memory area which it has been given and converts it into
a memory section for the private use of the task. This private section is identified by a
memory handle, a 32-bit identifier which is returned to the caller. As long as the task
does not make the memory handle public, the section remains private to the task.
The memory handle must be used to allocate smaller blocks from the private memory
section. Memory Manager procedure ajmgeh is used to acquire a memory block from a
private memory section identified with a handle. Once a private memory section has
been created, any task having the handle can acquire a memory block from the private
section. It is up to the task which created the private memory section to determine which
tasks are given the handle.