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.
String Array Storage
◄Variable Storage & Memory Use► ◄Variables► ◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
String Array Storage
A string array has three parts in memory: the array descriptor, the array
of string descriptors, and the string data. The array descriptor is always
stored in DGROUP. Each element in the array of string descriptors is stored
in DGROUP and contains the length and location in memory of the string
data. The string data resides in the near heap if near string storage is
specified at compile time, or in far heap if far string storage is
specified at compile time. The 4-byte string descriptor for each
variable-length string resides in DGROUP regardless of which string option
(near or far) is used.
BASIC string arrays can be either static or dynamic. A "static string
array" is an array of variable length strings whose descriptors reside
in a permanently allocated array in DGROUP. This array of descriptors
is fixed when compiled and cannot be altered while a program is running.
A "dynamic string array" is a string array whose array of descriptors can
be defined or changed during runtime with BASIC's DIM, REDIM, or ERASE
statements. Dynamic arrays that are declared local to a procedure are
deallocated when control leaves the procedure. As with static string
arrays, dynamic string array descriptors also reside in DGROUP, but they
may change in number and/or location during execution of a BASIC program.
The location of the string data itself is independent of the static or
dynamic status of a string array and depends solely on whether the near
or far string option is chosen when compiling.