20100114 clearing solaris memory segments and semaphores - plembo/onemoretech GitHub Wiki
title: Clearing Solaris memory segments and semaphores link: https://onemoretech.wordpress.com/2010/01/14/clearing-solaris-memory-segments-and-semaphores/ author: lembobro description: post_id: 199 created: 2010/01/14 22:33:02 created_gmt: 2010/01/14 22:33:02 comment_status: open post_name: clearing-solaris-memory-segments-and-semaphores status: publish post_type: post
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 as of Thu Jan 14 17:07:17 EST 2010
T ID KEY MODE OWNER GROUP
Message Queues:
Shared Memory:
m 50 0×69020634 –rw-r–r– tsuser tsgroup
m 49 0×6301fd58 –rw-r–r– tsuser tsgroup
Semaphores:
s 26 0×67020634 –ra-ra-ra- tsuser tsgroup
s 25 0×66020634 –ra-ra-ra- tsuser tsgroup
s 24 0×6a020213 –ra-ra-ra- tsuser tsgroup
s 23 0×64020111 –ra-ra-ra- tsuser tsgroup
`
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.
Copyright 2004-2019 Phil Lembo