Memory allocation: Difference between revisions

Content added Content deleted
(+ D entry)
(→‎{{header|REXX}}: added more verbage in the REXX section header. -- ~~~~)
Line 984: Line 984:


=={{header|REXX}}==
=={{header|REXX}}==
There is no explicit memory allocation in REXX, variables are just assigned.
There is no explicit memory allocation in the REXX language,   variables are allocated as they are assigned   (or re-assigned).
<br>Most REXXes will obtain a chunk of free storage, and then allocate storage out of that pool if possible, if not, obtain more storage.
<br>Most REXX interpreters will obtain a chunk (block) of free storage, and then allocate storage out of that pool if possible, if not, obtain more storage.
<br>One particular REXX has predefined and limited amount of free storage.

<lang rexx>Axtec_god.3='Quetzalcoatl ("feathered serpent"), god of learning, civilization, regeneration, wind and storms'</lang>
<lang rexx>Axtec_god.3='Quetzalcoatl ("feathered serpent"), god of learning, civilization, regeneration, wind and storms'</lang>

There is no explicit way to de-allocate memory, but there is a DROP statement that "un-defines" a REXX variable and it's memory is then free to be used for other variables, provided that free memory isn't too fragmented.
There is no explicit way to de-allocate memory, but there is a DROP statement that "un-defines" a REXX variable and it's memory is then free to be used for other variables, provided that free memory isn't too fragmented.

<lang rexx>drop xyz NamesRoster j k m caves names. Axtec_god. Hopi Hopi
<lang rexx>drop xyz NamesRoster j k m caves names. Axtec_god. Hopi Hopi


/* it's not considered an error to DROP a variable that isn't defined.*/</lang>
/* it's not considered an error to DROP a variable that isn't defined.*/</lang>
Any variables (that are non-exposed) which are defined (allocated) in a procedure/subroutine/function will be un-allocated at the termination (completion, when it RETURNS or EXITs) of the procedure/subroutine/function.

Any variables (that are non-exposed) which are defined (allocated) in a procedure/subroutine/function will be un-allocated at the termination of the procedure/subroutine/function.
<br><br>
<br><br>