Tech Note 08: Maximum size of variables
April 7, 2001
© 2020 NSB Corporation. All rights reserved.
The maximum size of any variable is 64k.
elements*2 + (length+1 of all assigned strings) + 4
Array elements that do not have any value assigned yet do not take up space. If each element as just 1 character, the maximum would depend on the number of elements.
For example, DIM s(16000) requires 32000 bytes overhead. This leaves approx 32k for string values, so 32000 / 2 ("x" + null) = 16000 before the limit is reached. In the actual tests, the value is 15995, due to some overhead.
On the other hand, if "xxxx" is assigned to every element, the remaining 32k / 5 = 6400 before the limit is exceeded.