Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
Article Q26494, Example 2
◄Contents► ◄Index► ◄Back►
─────────────────────────────────────────────────────────────────────────────
◄Knowledge Base Contents► ◄Knowledge Base Index►
"Subscript Out of Range" for Array > 128K; Gaps in Far Heap, Example 2
The following code example demonstrates the "Subscript out of range"
error message:
' To try this example in VBDOS.EXE:
' 1. From the File menu, choose New Project.
' 2. Copy the code example to the Code window.
' 3. Press F5 to run the program.
DEFINT A-Z
TYPE test
a AS DOUBLE ' Uses 8 bytes.
b AS STRING * 288 ' Uses 288 bytes.
END TYPE
max = 453
REM $DYNAMIC
PRINT FRE(-1) ' Prints free heap space.
DIM x(1 TO max) AS test ' 453 * (288 + 8) = 134088 bytes used.
PRINT FRE(-1),"AFTER DIM"
END