Retro Rocket OS
BASIC-Powered Operating System
Loading...
Searching...
No Matches
MEMALLOC Function
MEMALLOC(integer-expression)

Allocates a block of heap memory of the given size (in bytes) and returns a pointer/integer handle to it.


Examples

size = FILESIZE("/system/webserver/logo.png")
buf = MEMALLOC(size)
REM ... use buf with BINREAD / SOCKBINWRITE ...
MEMRELEASE buf

Notes

  • Contents are unspecified on allocation.
  • Always pair with MEMRELEASE to avoid leaks.
  • The allocated memory is only valid while the program that requested it is running. The returned value ma be passed to other programs, however be aware of this restriction.
  • Returned handle is suitable for binary I/O (BINREAD, BINWRITE, SOCKBINWRITE, SOCKBINREAD).
  • Once the program ends, all memory requested by MEMALLOC is automatically freed.

See also: MEMRELEASE · BINREAD · BINWRITE