i want to delete a shared memory which is in use, i mean it is still attached and some processes are using them. I am using to delete "ipcrm -shm shmid". But it is not able to delete the shared memory.

In my code i am not deattaching shared memory after its use. coz i need it to be attached to maintain a counter.

Can anybody give some input on this.