# reserve_memory

When `reserve_memory` is non-zero, the EMS server allocates a block of memory for use in emergency situations to prevent the EMS server from being unstable in low memory situations.

    reserve_memory = size

When the server process exhausts memory resources, it disables clients and routes from producing new messages, and frees this block of memory to allow consumers to continue operation (which tends to free memory).

The EMS server attempts to reallocate its reserve memory once the number of pending messages in the server has dropped to 10% of the number of pending messages that were in the server when it experienced the allocation error. If the server successfully reallocates memory, it begins accepting new messages.

The `reserve_memory` parameter only triggers when the EMS server has run out of memory and therefore is a reactive mechanism. The appropriate administrative action when an EMS server has triggered release of reserve memory is to drain the majority of the messages by consuming them and then to stop and restart the EMS server. This allows the operating system to reclaim all the virtual memory resources that have been consumed by the EMS server. A trace option, `MEMORY`, is also available to help show what the server is doing during the period when it is not accepting messages.

Specify size in units of MB. When non-zero, the minimum block is 16MB. When absent, the default is zero.

Note: There are a variety of limits that the user can set to prevent the EMS server from storing excessive messages, which can lead to situations where the EMS server runs out of memory. These include global parameters, such as `max_msg_memory`, as well as destination properties such as `maxbytes`. These limits should be used to prevent the `reserve_memory` mechanism from triggering.
Copyright © Cloud Software Group, Inc. All rights reserved.