A fixed-size memory block allocation algorithm has been introduced to provide a method of memory allocation that executes in deterministic time, independent of the number of allocated blocks. This method is widely used in real-time applications.
The first step is to initialize the memory pool using the stFixedMemInit function. Subsequently, stFixedMemAlloc can be used to allocate memory blocks, and stFixedMemFree to release them within the specified memory pool.
All allocated blocks have a fixed size, which is defined during memory initialization. This size is aligned to the value specified in the AR_MEMORY_ALIGNMENT constant, defined in the architecture specific files. Block addresses are always aligned relative to the base address specified during initialization, rather than absolute zero (NULL).
These functions do not set the last error code upon failure. Access to fixed-size memory is not synchronized internally; if thread safety is required, it must be implemented externally.
If the fixed-size memory management module is not required, it can be excluded from compilation by setting ST_USE_FIXMEM to 0.