better release of the shared memory