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.
Array Out of Memory Error
◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
Array Out of Memory Error
■ It is possible to get a "Subscript out of range" error when you declare a
huge dynamic array, even though you have plenty of memory. This is because
when you use the huge (/Ah) option, you can declare dynamic fixed-length
string arrays and dynamic numeric arrays to a size greater than 64K.
However, if you are declaring an array and the size of its elements isn't
an even power of 2, the array will be limited to 128K.
See: ◄BC Command-Line Options►
■ You can obtain huge arrays greater than 128K by padding the type to become
a size that is a power of 2. For example:
TYPE Padded
A AS DOUBLE
B AS STRING * 215
Pad AS STRING * 33 ' To pad out the type to 256 bytes
END TYPE
Max = 430
REM $DYNAMIC
DIM NewOne(Max) AS Padded
See: ◄Array Storage Summary►