shared memory not being freed?

Hi
I'm using the shmget to generate a section of meory shared by both client and server.
There is something strange happening. When key=X, shmget fails when I run the server. If I change X to something else (say XX), both server and client wirk well. MAkes me think that chunkk of memory with name X got stuck somewhere in memory and can not be freed.
Also when I run the client and I assign key=any value where any value is a totally unrelated number, shmget still runs correctly.
the code I use is the following, by the way I'm using freeBSD on a vmware virtual machine and g++, thanks

server
shmid = shmget(key, mySize, IPC_CREAT | 0666))

client
shmid = shmget(key, mySize, IPC_CREAT | 0666))
Have you considered using the POSIX shared memory API instead of SysV? It's a cleaner interface IMO. See shm_overview(7)
I decided on SV because it is my understanding that it is the most portable way to manage shared memory. I'm using freeBSD.
Topic archived. No new replies allowed.