alloc

ALLOCATE FREE MAX-MAPPED MAPPED HP

Library notes














ALLOCATE ( # -- a | 0 )
Does the same as 'ALLOT', with the exception that it gives space from the mapped memory heap.
FREE ( -- )
Gives memory allocated with 'ALLOCATE' back to the memory manager.
MAX-MAPPED ( -- )
Variable containing the max allowed mapped memory.
Is use to restrict the memory usage.
MAPPED ( -- )
Variable containing the number of mapped memory bytes at this moment.
HP ( -- )
Variable pointing to the first free block in the heap.
Can be used to write debugging utilities or even to do some defragmentation.
Library notes
This memory library is very simple!
It does not handle fragmentation at all, making it imposible to use this library in any long running programs.

So it`s useless?
No, it`s fine for small programs, like: Small unix like utilities, CGI scripts and even any bigger application with small memory requirements.
But yes, for a database server, graphical game or such with special memory requirements it`s difficult to use this library.