memory_allocate size near -> address
  arg Int size ; arg address near ; arg address address

Allocates 'size' bytes. If these bytes are for storing a subpart of an object, you must provide the address of the object in 'near'. If not, provide null as 'near' parameter.
If no more memory is available, the function will not return null but rather generate a fatal error that will stop the program disgracefully.

memory_zallocate size near -> address
  arg Int size ; arg address near ; arg address address

The allocated bytes will be filled with zeros.

memory_resize old_address size near -> new_address
  arg address old_address new_address near ; arg Int size

Resizes the allocated area.

memory_zresize old_address size near -> new_address
  arg address old_address new_address near ; arg Int size

If the area is extended, the extra bytes will be filled with zeros.

memory_free address
  arg address address

Releases an allocated area.

memory_size address -> size
  arg address address ; arg Int size

Return the true size of the allocated area.


Walks around all memory chunks in order to check if everything is all right. This will be an efficient check only if running at debugging level 2 at least.


attempts to unallocate (at OS level) all memory pages that are completely contained in a free chunk.