Tech Note 08: Maximum size of variables

April 7, 2001

© NSB Corporation. All rights reserved.



Simple Variables

All numeric variables are represented internally by 8 byte floating point variables. String variables have a maximum of 32767 characters.

Arrays

In both string and numeric variables, the limit is determined by the number of elements.

elements=maxsub1*maxsub2*maxsub3*...

The maximum size of any variable is 64k.

String Arrays

The limit is defined by this formula:

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.

Numeric Arrays

The limit is 64k / 8 = 7999.