What Unix do with unused shared memory?

view full story

http://www.unix.com – Hello, When creating shared memory in C, should be remove shared memory with shmctl function when don't need it. If it didn't remove, occupied shared memory stay and remain. If we create shared memory repeatedly without removing unusable shared memory, /dev/shm will full. Does Unix or Linux distributions do action to them? For example if a shared memory has 0 shm_nattch and wasn't used in long time, remove them. (HowTos)