Statically allocated memory is memory allocated by the program for variables and static data like string constants, lists and typed lists (see 9.5.7 Static data).
Every variable in a program requires some memory in which to store its value.
Variables declared to be of type
STRING or any object require two lots of memory: one to hold the value of the pointer and one to hold the large amount of data (e.g., the elements in an
In fact, such declarations are merely
PTR TO type declarations together with an initialisation of the pointer to the address of some (statically) allocated memory to hold the data.
The following example shows very similar declarations, with the difference being that in the second case (using
PTR) only memory to hold the pointer values is allocated.
The first case also allocates memory to hold the appropriate size of array, object and E-string.
DEF a:ARRAY, m:myobj, s:STRING DEF a:PTR TO CHAR, m:PTR TO myobj, s:PTR TO CHAR
The pointers in the second case are not initialised by the declaration and, therefore, they are not valid pointers. This means that they should not be dereferenced in any way, until they have been initialised to the address of some allocated memory. This usually involves dynamic allocation of memory (see 14.3 Dynamic Allocation).
Go to the Next or Previous section, the Detailed Contents, or the Amiga E Encyclopedia.