Please enable JavaScript to view this site.

ESL Documentation

The set low memory threshold statement designates the minimum amount of free memory (in bytes) needed during the execution of the program. This statement should be specified at the beginning of the program, usually in the response to start response statement. If it is not specified in the program, a default value of 5,000 bytes is set.

The set low memory threshold statement allows you to set the trigger value for which the response to low memory response statement will be executed. For example, if you know that the minimum amount of free memory required in your program is 2000 bytes, you might specify.

Example

response to start

set low memory threshold to 2000

...

response to low memory

# The response is

change to program Next_Choice 

# executed if

# less than 2000

# bytes are

# available.

The low memory threshold can be adjusted during the execution of the program. As shown in the following example, if ESL is adding text to a textual region and the low memory threshold is reached, the program can notify the user of the situation and allow the user to take actions until a minimum threshold is reached. The program then writes the contents of the textual region to a file and exits gracefully.

Example

integer Warn_Value is 10000

integer Min_Value  is  2000 

 

response to start

 ...

 

 

response to low memory

 squeeze memory

 if (freesize <= Warn Value) then

         action ShowWarnMessage

         copy (Warn_Value - 5000) to Warn_Value

         if (Warn Value < Min Value) then

                 write TextRegA to file "memreg.sav"

                 exit

         else

                 set low memory threshold to Warn_Value

         end if

 end if