Software
mori

mori

Shared Memory for R Objects

19 stars
1 forks
MIT License
R

mori shares R objects across processes on the same machine via a single copy in OS-level shared memory — POSIX shared memory on Linux and macOS, Win32 file mapping on Windows. Every process reads from the same physical pages through the R ALTREP framework, giving lazy, zero-copy access.

share() writes an R object into shared memory and returns an ALTREP wrapper that behaves like a regular R vector. Shared objects serialize compactly as their shared-memory name rather than their full contents, so sending a shared data frame to a mirai daemon transmits ~300 bytes instead of the underlying 200 MB. Shared memory is managed by R’s garbage collector and freed automatically when the last reference is dropped, and consumer processes see the data as read-only so copy-on-write keeps mutations local.

Contributors#

Posts about mori#