The REXIS memory allocator uses a best-fit always-merge algorithm. The free memory list is searched to find the smallest sized block sufficient for the allocation request, and when a memory block is deallocated it is merged with the neighboring free blocks to obtain the largest size possible free block. The former minimizes holes created by the allocation, and the latter minimizes fragmentation.
REXIS uses memory allocation in the following cases:
a) To allocate the Task Control Block for a task
b) To allocate the task stack,
c) To create a MUTEX, semaphore, or a mailbox