Please enable JavaScript to view this site.

ESL Documentation

Action Statement

Eliminate fragmentation of memory.

squeeze memory

Description

Use this statement to eliminate fragmentation of memory, thus freeing one larger block of memory for use by the program.

The squeeze memory statement is generally used in conjunction with the response to low memory response statement and the freesize built-in function. This action takes a few seconds to execute, so use it only when necessary.

ESL automatically implements the squeeze memory function after you compile your program, and when you specify a save program statement.

The squeeze memory statement can only be called directly from a response, or from an action routine that is called directly from a response. It should never be called from a subroutine or from an action routine that is called from a subroutine. Before ESL performs the memory squeeze, it checks to see if a subroutine is active. If there is an active subroutine, ESL will send an error message to the errorlog saying:

ignoring squeeze memory: squeeze memory is not supported while a subroutine is active.

If the squeeze memory fails due to an active subroutine, ESL will check the low memory threshold each time a block is entered or after the completion of the outermost response.

Squeeze memory is performed implicitly with the "save program as" statement.

Note that you cannot use squeeze memory in an application that uses ESL Database Support subroutines and functions.

Example

 

action CheckMemory is

 if (freesize >= SizeNeeded) then

           copy true to MemoryOk

 else

           copy false to MemoryOk

         squeeze memory

 end if

See Also

freesize Special Inquiry Built-in Function

response to low memory Response Definition

set low memory threshold Action Statement

save program as Action Statement