Thursday, January 14, 2010
Clearing Solaris memory segments and semaphores
Sometimes you just need to wipe the slate clean.
When there’s a bunch of apps eating away at memory eventually something will tank. At that point just shutting stuff down may not be enough, especially when you’ve got to resort to the kill command to make them dead. Very often all those memory segments and semaphores related to the errant app are still taking up scarce resources.
Addressing this in Solaris involves taking the following steps:
1. Use ipcs to list all the memory segments and semaphores associated with the app user (this is another good reason to have a separate system user for each app).
ipcs | grep [username]
Here’s typical output:
[root@testbox ~]$ ipcs
IPC status from
2. Run ipcrm against each of the IDs listed. Kill the memory segments and then the semaphores.
ipcrm -m 50
Running ipcrm with the -M switch allows you to use the hex KEY instead of the ID.
