APPENDIX
I
.
H
Dynamic (RUN-Time) Memory Allocation
Integer variables:
(2
for value, 3 for variable name)
Single-precision variables:
(4
for value,
3
for variable
name)
Double-precision
variables:
(8
for value, 3 for variable name)
5 bytes each
7 bytes each
1 1 bytes each
String variables: 6 bytes minimum
(3
for variable
name,
3 for stack
and
variable pointers, 1 for each character)
Array
variables:
12 bytes minimum
(3
for
variable name, 2 for total size, 1 for
number of dimensions,
2
for size of
each dimension , and
2,
3
, 4 or 8 [depending
on
array type]
for each element in the array)
Each active
FOR- NEXT loop
requires 1
6
bytes.
Each active (non-returned)
GOSUB
requires 6 bytes.
Each level of parentheses requires 4 bytes
plus
1 2
bytes for each temporary value.
General Formula for Computing Memory Requirements of Arrays
The array
G (Nl , N2, . .
.
, Nk)
requires the
following
amount of memory:
14
+ (k*2) +
T*j(N1+1)*(N2+1)*...*(Nk+1)[
where
k is the number
of dimensions in
the
array, and the value of T depends on the
array type:
Type
T
=
Integer
2
Single-Precision
4
Double-Precision
8
String*
3
*In computing the actual memory
requirements of string arrays, you
must add
the
text length of each element in the array.
When
the array
is first
dimensioned, all
elements have length
o.
The string text will be stored in the string space (reserved by
the CLEAR n statement).
221