ipcs(1) provides information about IPC capabilities, and ipcrm(1) can be used to remove IPC objects from the system.
List the shared memory segments:
 ipcs -m 
Message Queuing List:
 ipcs -q 
Delete the shared memory segment created with shmkey :
 ipcrm -M key 
Delete the shared memory segment identified by shmid :
 ipcrm -m id 
Delete the message queue created with msgkey :
 ipcrm -Q key 
Delete the message queue identified by msgid :
 ipcrm -q id