Calculating heap memory

To calculate how much heap memory Adaptive Server sets aside, perform the following (Adaptive Server reserves a small amount of memory for internal structures, so these numbers vary from site to site):

((1024 X 1024) + (heap memory in bytes)* (number of user connections + number of worker processes) )

The initial value of (1024 X 1024) is the 1MB initial size of the heap memory pool. Adaptive Server reserves a small amount of memory for internal structures.

For example, if your server is configured for:

@@heapmemsize reports 1378304 bytes.

And the estimated value using the formula above, is:((1024 X 1024) + (4 X 1024 X 50)) = 1253376

Now, if you increase the number of user connections, the size of the heap memory pool increases accordingly:

sp_configure 'user connections', 100

@@heapmemsize reports 1716224 bytes.The estimated value in this case is:((1024 X 1024) + (4 * 1024 * (100 + 25) ) = 1560576

If your applications fail with this message:

There is insufficient heap memory to allocate %ld bytes. Please increase configuration parameter 'heap memory per user' or try again when there is less activity on the system.

Increase the heap memory available to the server by increasing one of:

The size of the memory pool depends on the number of user connections. Sybase® recommends that you set heap memory per user to at least three times the size of your logical page.

Sybase recommends that you first increase the heap memory per user configuration option before you increase number of user connections or number of worker processes. Increasing the number of user connections and number of worker processes consumes system memory for other resources, which may require you to increase the server’s maximum memory.See Chapter 5, “Setting Configuration Paramters in the System Administration Guide: Volume 1.