PDA

View Full Version : forgot to delete shared memory file in main program



EzarKun
October 8th, 2007, 03:15 AM
Hi,
newbie here.

I made a program first, without using
shmdt
but later put it in
i was wondering how to clean the place the shared memory is placed cause, whenever I run the program, it gives an error that the shared memory already exists.

thanks

dwhitney67
October 8th, 2007, 03:26 AM
It's been years (14 to be exact) since I've worked with shared memory between programs. I believe the process that created the shared memory needs to call shmctl() when it is done with the segment, but I could be wrong.

In code, the usage is:


#include <sys/ipc.h>
#include <sys/shm.h>

...

shmctl( shmid, IPC_RMID, 0 );