ipc: unmap shared memory before destroy
What's going wrong:
When
- the client dies but the server is still alive OR
- the XR_Instance is destroyed but the client process is still alive
A memory leak happens at ipc_shared_memory
Why it happens
Close the ipc_handle
(a file descriptor)doesn't release the memory, unmap()
must be called before closing the FD to actually release the memory.
I'm not sure about the kernel side, but probably
map()
also increases reference count in the kernel, so it takes it as an unreleased region even if no FD is pointed to it
What is the MR mainly about
- Called
ipc_shmem_destroy()
When destroying ipc_server and ipc_client - Add a new function
ipc_shmem_unmap()
and called it inipc_shmem_destroy()
-
ipc_shmem_destroy
prototype is changed to include new paraments used for unmap.
Edited by hadrian Wang