I am creating, writing to and reading from a shared segment on Linux using the ftok/shmget/shmat/shmdt functions.
If I write to the segment in one program which then exits, and subsequently read the segment from another program later, I am surprised to find the data still there.
I would have expected that when the last process sharing a segment does a shmdt, the segment would be free'd.
Can I rely on this behavior? Or is it analogous to continuing to use a pointer after free()'ing it?