NX Client may print 'Warning: Can't create the shared memory segment' on Mac OS X
NX Client running on Mac OS X may print the following warning in the session log:
Warning: Can't create the shared memory segment. Error is 12 'Cannot allocate memory'.
However, this warning is not critical for the correct functioning of the session, because the shared memory is used only to slightly increase session performances.
This is due to an hard limit imposed to the shared memory segment size by the kernel. This limit can be printed with the following command executed in a terminal:
sysctl -A 2>&1 | grep shm
The value of kern.sysv.shmmax reports the actual size cap.
It's possible to solve this issue in two ways.
- The size of the shared memory segment allocated by NX depends on the size of the cache in memory, with a maximum of 4096 Kb. By lowering the cache size, the available shared memory segment size may be enough for the allocation. Even if this solution may fix the warning about the shared memory, it may affect performances because it may cause too many cache misses.
- The second solution consists of modifying the kernel settings. The sysctl command allows to dynamically change these settings (administrator rights are needed to execute it):
sysctl -w kern.sysv.shmmax=8388608
sysctl -w kern.sysv.shmall=2048If the NX session starts without warnings, these values can be saved in the /etc/sysctl.conf file (if this file doesn't exist, it must be created):
# Increase the shared memory segment size
kern.sysv.shmmax=8388608
kern.sysv.shmall=2048
Some useful documentation on the topic is:
