Try creating a shared memory segment via shm_open before falling back to a temporary file. This is a better approach for macOS and other systems lacking memfd.
shm_unlink is called immediately after a successful shm_open to minimize the lifetime of the shared memory segment name; the underlying shared memory segment is kept alive by the fd returned by shm_open and the fd we later clone to the client to use in SharedMem::from.
Try creating a shared memory segment via
shm_open
before falling back to a temporary file. This is a better approach for macOS and other systems lacking memfd.shm_unlink
is called immediately after a successfulshm_open
to minimize the lifetime of the shared memory segmentname
; the underlying shared memory segment is kept alive by the fd returned byshm_open
and the fd we later clone to the client to use inSharedMem::from
.