TABLE OF CONTENTS
/Malloc-Static [ Modules ]
DESCRIPTION
Static memory allocation strategy. Reserves requested memory blocks in a linear, incremental fashion and cant Free blocks. Allocate all needed objects on system startup and never try to Free/reallocate blocks, this will result in a memory leak.
Malloc-Static/Free [ Functions ]
[ Top ] [ Malloc-Static ] [ Functions ]
DESCRIPTION
Dummy for compatibility reasons, has no function
DECLARATION
Sub Free(byref Pointer As Word) End Sub
Malloc-Static/Malloc [ Functions ]
[ Top ] [ Malloc-Static ] [ Functions ]
DESCRIPTION
Reserves a block of memory of the requested size if available. Returns 0 if not enough memory left.
DECLARATION
Function Malloc(byval Size As Word) As Word
SOURCE
Local Newblock As Word Os_enter_critical Newblock = Malloc_free_pointer + Size If Newblock > Ram_end_free Or Size = 0 Then Newblock = 0 Else Newblock = Malloc_free_pointer Malloc_free_pointer = Malloc_free_pointer + Size Malloc_free_pointer = Malloc_free_pointer + 1 End If Os_exit_critical Malloc = Newblock End Function