Get each process to shm_unlink() the shared memory - once they have all done this, the shared memory will be released.