Skip to content

ipc: unmap shared memory before destroy

What's going wrong:

When

  1. the client dies but the server is still alive OR
  2. 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

  1. Called ipc_shmem_destroy() When destroying ipc_server and ipc_client
  2. Add a new function ipc_shmem_unmap() and called it in ipc_shmem_destroy()
  3. ipc_shmem_destroy prototype is changed to include new paraments used for unmap.
Edited by hadrian Wang

Merge request reports