Avisaro Online Documentation - Wiki
Impressum Kontakt Sitemap

MEMCFG

Description

This command can be used to configure the memory environment of the program that contains the command as its first line. If used, MEMCFG must be the first statement of a BASIC script, otherwise it is rejected. The configuration is only valid for this program.

MEMCFG requires three arguments in the following order:

1) Size of the BASIC heap (space for variables, arrays, string operations and subroutine pointers)

2) Size of the code segment, that is, memory which contains the compiled byte code.

3) Size of the data segment. This segment holds constant data that is accessible by the READ statement.

All arguments must be a multiple of four.

 The following restrictions apply:

The heap (first argument) should not be smaller than 3500 bytes, since the virtual machine which executes the script uses the heap internally for temporary data like string copies and so on.

None of the arguments shall be zero.

The sum of all arguments can not exceeed 12288 bytes.

If MEMCFG is not used, the default configuration is:

Heap size: 8192 Bytes

Code segment: 3072 Bytes

Data segment: 1024 Bytes

Example

This is the first line of the script

MEMCFG 3500, 4000, 100
' script continues ...

Result: This sets the heap to 3500, the code segment to 4000 and data segment to 100 bytes

Remarks

The majority of BASIC scripts doesn't need to change the memory configuration, since the default settings are suitable for most needs. Though, most configuration mistakes are detected by the VM, programs that use a faulty configuration can behave unexpectedly.