The response to low memory statement is taken when ESL reaches a minimum threshold of available memory during execution. The threshold is either set by you in the set low memory threshold action statement, or has a default value of 5,000 bytes.
There can be only one response to low memory statement in a program. It must be located in the outermost responses area of the program (that is, not inside a block structure).
During runtime, ESL processes an internal program memory check after execution of each response statement. The response to low memory statement is invoked when available memory has fallen below the low memory threshold which is by default 5000 bytes, or set in the set low memory threshold statement.
In the following example, if the threshold is reached during a response statement, the response statement is completed, and the program then executes the response to low memory and performs a squeeze memory. Then, if there is enough memory, ESL returns to the same state as before the response to low memory statement was taken. If there is still not enough memory, the action Warn_User takes place.
response to low memory
squeeze memory
if (freesize < 2000)
then action Warn_User
end if
The response to low memory statement is not invoked if ESL is within a loop, since ESL checks memory only after the execution of a response statement, and a loop consists of a series of continuous action statements.
This response will interrupt all blocks including a guarded block, however, the squeeze memory statement cannot be performed when a subroutine is active.