[SunHELP] How to tell what spawned an orphan shmid

Dale Ghent daleg at elemental.org
Wed May 8 16:43:10 CDT 2002


On Wed, 8 May 2002, Joe Pampel wrote:

| Ok, this could be a weird one but here goes:
|
| Our back office runs on a pretty fancy database program. It runs in memory (so
| it's a whole lot faster than anything with a disk I/O) To see the shared
| memory ID (shmid) it is using, we would typically use the IPCS -m | grep
| <shmemkey>.
| Here is our problem:
| The program is spawing orphaned shmid's  - a memory leak, and while we can
| clean things up manually or via cron what I'm wondering is this - can we
| determine which shared memory segments do not have active processes associated
| with them? Or alternatively can I somehow query to find what process a
| particular shmid thinks it is associated with and then compare that to IPCS to
| see if it in fact exists etc ( and then run ipcrm -m <shmid> to remove the bad
| stuff)  or something along those lines? (using perl probably)

ipcs -mp

CPID is the process that created the segment
LPID is the last process to attach and send/get data to/from the segment

the CPID doesnt necessarily have to exist, but if LPID dosnt change for a
long time and the PID listed no-longer exists, then the segment might just
be orphaned.

It would be great if lsof or something would list the shmids that the
process is currently accessing.

/dale



More information about the SunHELP mailing list