ChronOS Memory Management: Static: Unterschied zwischen den Versionen

Aus ProjectWiki
Wechseln zu:Navigation, Suche
K
K
 
Zeile 5: Zeile 5:
 
In this case, only the function Malloc() is implemented, Free() just does nothing.
 
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.
 
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:
 
<pre>
 
Dim Object As Word
 
Object = Malloc(Byval Size As Word)
 
</pre>
 
  
  

Aktuelle Version vom 21. Mai 2013, 22:32 Uhr

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