Kill
Kill
is an instruction that destroys variables permanently.
Kill VAR_LIST
VAR_LIST
is a list of existing variable names separated by commas. The variables can be global or local variables. # Let's suppress several variablesKill MY_STRING, [V]GLOBAL_VAR, [L]AMOUNT# Let's create an array of pointersLocal Instance POINTERS(1..10) Using C_MYCLASSPOINTERS(1)=NewInstance Using C_MYCLASS AllocGroup NullFor I=2 to dim(POINTERS)POINTERS(I)=NewInstance Using C_MYCLASS AllocGroup POINTERS(I-1)Next I...# Now let's free everything:# First the allocation groupFreeGroup POINTERS(1)# Second the variable that referenced the instanceKill POINTERS
Kill
allows you to delete a variable. Only variables in [L] or [V] class can be killed.
An old syntax allows you to use Kill
with [L] as a unique argument to destroy all the variables in the local class. This is not recommended for several reasons:
* Such a class is automatically destroyed when an End instruction is encountered. Therefore, the need does not exist.
* The parameter descriptions of a call are in the [L] class. Although it does not destroy the variables sent as references, you do not have access to the corresponding reference in the call after the Kill
is done.
Kill
only frees the memory used by variables declared as Local or Global variables or arrays. The memory spent by a NewInstance instruction must be freed by Freegroup or Freeinstance.
Error code | Description |
---|---|
6 | Variable does not exist. |
7 | Class does not exist. |
34 | The class mentioned for the variables is not [L] or [V]. |
Raz, type, dim, FreeInstance, Freegroup.