Here is short trick how to clean the shared memory up in Solaris OS.
Here is short info about the host(solaris 5.9, arch sparc):
uname -a SunOS hostname1 5.9 Generic_118558-25 sun4u sparc SUNW,Sun-Fire-V890 Solaris
To see all shared memory segment, use ipcs
user1@~>ipcs -m -a IPC status fromas of Wed Mar 10 16:26:20 CET 2010 T ID KEY MODE OWNER GROUP CREATOR CGROUP NATTCH SEGSZ CPID LPID ATIME DTIME CTIME Shared Memory: m 4608 0x5efaa728 --rw-r----- oracle oinstall oracle oinstall 23 3992993792 5720 18925 16:24:47 16:24:47 11:59:42 m 5246977 0x517b6233 --rw-r--r-- user1 os_int user1 os_int 32 7352048 10685 16417 16:21:26 16:21:26 16:13:35 m 1969154 0x22b80b3e --rw-r--r-- user1 os_int user1 os_int 3 72552448 10689 11443 16:14:19 16:13:51 16:13:37 m 1967619 0x1b68b6e6 --rw-r--r-- user1 os_int user1 os_int 8 438326272 10689 16417 16:21:26 16:21:26 16:13:38 m 1966084 0x5724f977 --rw-r--r-- user1 os_int user1 os_int 14 212926464 10689 11379 16:14:27 16:13:50 16:13:40 m 1966085 0x534aab2a --rw-r--r-- user1 os_int user1 os_int 10 216572928 10689 11442 16:14:38 16:13:51 16:13:42 m 11391045 0x7bfc552e --rw-r--r-- user2 os_int user2 os_int 0 7352048 8047 9445 14:43:22 14:43:40 13:41:22 m 10461766 0x63fcba9b --rw-r--r-- user2 os_int user2 os_int 0 72552448 8114 9457 14:43:22 14:43:38 13:41:25 m 9721415 0x5cad6643 --rw-r--r-- user2 os_int user2 os_int 0 583097344 8114 9459 14:43:22 14:43:38 13:41:27 m 9655368 0x1869a8d4 --rw-r--r-- user2 os_int user2 os_int 0 212926464 8114 9466 14:43:22 14:43:38 13:41:29 m 9753673 0x148f5a87 --rw-r--r-- user2 os_int user2 os_int 0 216572928 8114 9473 14:43:22 14:43:38 13:41:31
To delete/destroy/remove any segment of the shared memory, use ipcrm. You can specify segment by shmkey(3-rd field in ipcs output) or by shmid(2-nd field) use -M and -m accordingly . Like :
ipcrm -m 4608
or
ipcrm -M 0x5efaa728
To remove all segment in shared memory where owner is user1, run
ipcs -m -a | awk '{if($5 ~ /user1/ && $1 ~ /m/) print "ipcrm -m "$2;}' | bash
END.