ChronOS Memory Management: Static
Aus ProjectWiki
Version vom 20. Mai 2013, 20:39 Uhr von Mat (Diskussion | Beiträge)
Functional description
In the most embedded OS applications, it is not neccessary to use a dynamic memory allocation algorithm. If it is possible to create all used objects during the start-up and there is no need to ever release an object, the memory management becomes much simplier. In this case, only the function Malloc() is implemented, Free() just does nothing. It works like an up-growing stack, a pointer is used which points at the begin of the free memory area, each time memory is requested, Malloc() returns the actual pointer value and then the pointer is incremented by the requested size. If there is not enough remaining free memory, Malloc() returns 0.
Usage
Request memory from free memory pool:
Dim Object As Word Object = Malloc(Byval Size As Word)