Avisaro Online Documentation - Wiki
Impressum Kontakt Sitemap

FREEMEM

Description

The Scripting Language's Virtual Machine manages a heap to store temporary and static objects. With FREEMEM, a pseudo variable, the program can ask the VM how many bytes are available to generate new objects like strings, arrays and so on. FREEMEM is read-only. An attempt to write to FREEMEM will be rejected by the compiler.

Example

The following program prints out how many bytes are allocated by both of two 1000-bytes arrays:

outmode -2
let a = FREEMEM
dim b(1000)
let a = a - FREEMEM
print a
let a = FREEMEM
dim c(1000)
let a = a - FREEMEM
print a

Remarks

Please notice that the VM always needs some heap memory for itself. If you create big arrays that occupy all heap space, the program might terminate with an out-of-memory error. See also the MEMCFG command.