Skip to main content


Contains the maximum available memory for a process.




$ZSTORAGE contains the maximum amount of memory, in Kbytes, for a job’s process-private memory. This memory is available for local variables, stacks, and other tables. This memory limit does not include space for the routine object code. This memory is allocated to the process as needed, for example when allocating an array.

Once this memory is allocated to the process, it is generally not deallocated until the process exits. However, when a large amount of memory is used (for example greater than 32MB) and then freed, Caché attempts to release deallocated memory back to the operating system, where possible.

You can also use $ZSTORAGE to set the maximum memory size. For example, the following statement sets the job’s maximum process-private memory to 524288 Kbytes:

   SET $ZSTORAGE=524288

Changing $ZSTORAGE changes the initial value for the $STORAGE special variable, which contains the current available memory (in bytes) for the process.

The maximum value for $ZSTORAGE is 2147483647. The $ZSTORAGE default is 262144. The minimum value for $ZSTORAGE is 128. $ZSTORAGE values larger than the maximum or smaller than the minimum automatically default to the maximum or minimum value. $ZSTORAGE is set to an integer value; Caché truncates any fractional portion (if specified).

You can change the $ZSTORAGE default by changing the Maximum per Process Memory (KB) system configuration setting. In the Management Portal, go to System, Configuration, Memory and Startup. You can increase Maximum per Process Memory (KB) as desired, up to a maximum of 2147483647 Kbytes. Changing Maximum per Process Memory (KB) changes the $ZSTORAGE value for subsequently initiated processes; it has no effect on the $ZSTORAGE value for current processes.


An operating system may impose a maximum memory allocation cap on running applications. If your Caché instance is subject to such a cap, a process may be unable to obtain all of the memory specified by $ZSTORAGE, resulting in a <STORE> error.


The following example sets $ZSTORAGE to its maximum and minimum values. Attempting to set $ZSTORAGE to a value (16) that is less than the minimum value automatically sets $ZSTORAGE to its minimum value (128):

  SET $ZS=128
  WRITE "minimum storage=",$ZS,!
  SET $ZS=16
  WRITE "less than minimum storage=",$ZS,!
  SET $ZS=2147483647
  WRITE "maximum storage=",$ZS,!

See Also

SET command

KILL command

$STORAGE special variable

FeedbackOpens in a new tab