shmat()

Shared memory, shmat(), is typically used by server address spaces to communicate with clients. It returns an out-of-memory condition when it can no longer obtain shared storage without exceeding its respective shared storage limit. It continues to use shared storage pages until the total resource consumption reaches the specified limit.

The __IPC_MEGA option enables applications to use large quantities of shared memory without system overhead. If you have applications that take advantage of this __IPC_MEGA support, you do not need to be concerned with the following calculations. The current usage can be calculated by multiplying the number of pages by the number of (connections plus 3) by 40.

Example: If a server that is using 500000 bytes of shared memory and has 49 clients connected to it, the consumption of ESQA can be calculated as:
500000 * (49 + 3) / 4096 * 40 = 253906  
You will find that 253906 bytes of ESQA, or approximately 248 KB, is needed.

The 49 plus 3 comes from 49 clients, one server, one anchor block, and one connection to a kernel data space that is used to manage the storage. Some servers use large amounts of shared memory that is shared by hundreds or thousands of clients, which can require large amounts of ESQA (up to one gigabyte).