Command RELEASE Foundation

Releases PUBLIC and/or PRIVATE variables.

RELEASE <VarName,...>
<VarName,...> is a comma-separated list of names (symbols) of PRIVATE or PUBLIC variables to release.
The option ALL assigns the value NIL to all memory variables declared PRIVATE within the function or procedure. The variables themselves (the symbols) are released only after termination of the corresponding function or procedure.
LIKE|EXCEPT <Wildcard>
<Wildcard> specifies a group of variables and can include the two characters ? and * as wildcard characters. ? stands for any single character in a variable name and * indicates any string. The LIKE option assigns the value NIL to all PRIVATE variables declared within a function or procedure whose names match <Wildcard>. The variables themselves (the symbols) are released only after termination of the corresponding function or procedure. If the option EXCEPT is specified, all PRIVATE and PUBLIC variables are released except those matching with <Wildcard>.

The command RELEASE can be used in two distinct ways with different effects. When a list of variable names is explicitly specified after the command, the PUBLIC and PRIVATE variables in the list <VarName,...>are deleted and their memory space is released. If PRIVATE variables with the same name are declared in a calling function or procedure at a higher level, they are then visible at the underlying level.

All versions of RELEASE ALL access only those PRIVATE variables declared in the current function or procedure. The value NIL is assigned to these PRIVATE variables, which releases the contents of the variables. The variables themselves (the symbols) are retained and are only deleted from memory when the function or procedure is terminated. PUBLIC variables are not affected by RELEASE ALL.

LOCAL and STATIC variables cannot be released using RELEASE.

   MEMVAR cPrivate1, cPrivate2 
   MEMVAR cPublic1 , cPublic2 

   PRIVATE cPrivate1 := 1  , cPrivate2 := 2 
   PUBLIC  cPublic1  := "A", cPublic2  := "B" 

   ? cPrivate1                  // result: 1 
   ? cPublic1                   // result: A 


   ? cPublic2                   // result: B 
   ? cPublic1                   // runtime error: variable 
                                // no longer exists 


   MEMVAR cPrivate1, cPrivate2 

   PRIVATE cPrivate1 := 100, cPrivate2 := 200 

   ? cPrivate1                  // result: 100 
   ? cPrivate1                  // result: 200 

   ? cPrivate1                  // result: NIL 
   ? cPrivate2                  // result: NIL 

   RELEASE cPrivate1 

   ? cPrivate1                  // result: 1 
   ? cPrivate2                  // result: NIL 

   ? cPublic1                   // result: A 

   RELEASE cPublic1 

   ? Type("cPublic")            // result: U 


If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.