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 will vary from site to site):

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

The initial value of (1024 * 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 * 1024 * 50)) = 1316044.80

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 comes out to be:((1024 * 1024) + (4 * 1024 * (100 + 25) ) = 1638604.80

If your applications were to fail with the following error 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.

You can increase the heap memory available to the server by increasing one of:

Sybase recommends that you first try to 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 first consumes system memory for other resources, which may cause you to increase the server’s max memory.See Chapter 5, “Setting Configuration Parameters” in the System Administration Guide for more information on how to make memory related configuration option changes.

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.