[SunHELP] How to tell what spawned an orphan shmid

Joe Pampel joe at ardsley.com
Thu May 9 08:11:31 CDT 2002


Thanks! That's a big help. I don't know how I missed the 'p' and 't' flags in
the man pages.
Sorry about that.. musta been staring at this too long!

- Joe

>>> Dale Ghent <daleg at elemental.org> 05/08/02 05:43PM >>>
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