ChronOS Memory Management: Static

Aus ProjectWiki
Version vom 21. Mai 2013, 22:32 Uhr von Mat (Diskussion | Beiträge)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Wechseln zu:Navigation, Suche

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.


Sample