Command RELEASE Foundation
Releases PUBLIC and/or PRIVATE variables.
RELEASE <VarName,...>
RELEASE ALL [LIKE | EXCEPT <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.
PROCEDURE Main
MEMVAR cPrivate1, cPrivate2
MEMVAR cPublic1 , cPublic2
PRIVATE cPrivate1 := 1 , cPrivate2 := 2
PUBLIC cPublic1 := "A", cPublic2 := "B"
? cPrivate1 // result: 1
? cPublic1 // result: A
UserProc()
? cPublic2 // result: B
? cPublic1 // runtime error: variable
// no longer exists
RETURN
PROCEDURE UserProc()
MEMVAR cPrivate1, cPrivate2
PRIVATE cPrivate1 := 100, cPrivate2 := 200
? cPrivate1 // result: 100
? cPrivate1 // result: 200
RELEASE ALL
? cPrivate1 // result: NIL
? cPrivate2 // result: NIL
RELEASE cPrivate1
? cPrivate1 // result: 1
? cPrivate2 // result: NIL
? cPublic1 // result: A
RELEASE cPublic1
? Type("cPublic") // result: U
RETURN
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.