Retro Rocket OS
BASIC-Powered Operating System
Loading...
Searching...
No Matches
MEMPROGRAM Function
MEMPROGRAM

Returns the current amount of memory (in bytes) used by the private heap of the current BASIC program. This reflects the memory actively allocated right now, not the peak or global system usage.


Examples

REM Show memory used by this program
PRINT "Program is using "; MEMPROGRAM; " bytes"

For a large BASIC program this might print:

Program is using 401920 bytes
REM Compare with peak usage
PRINT "Currently used = "; MEMPROGRAM; " bytes"
PRINT "Peak used = "; MEMPEAK; " bytes"
REM Report usage in kilobytes
PRINT "Program heap = "; MEMPROGRAM / 1024; " KB"

Might print:

Program heap = 392 KB

Notes

  • Value is specific to the current BASIC program’s private heap.
  • Typically in the range of a few hundred kilobytes for larger programs.
  • Use MEMPEAK to see the maximum ever reached since program start.
  • Returned as a 64-bit integer.

See also: MEMPEAK · MEMUSED · MEMFREE · MEMORY · MEMRELEASE · MEMALLOC