The following code runs without error on macOS:
from multiprocessing.shared_memory import SharedMemory shm = SharedMemory(create=True, size=4) for b in shm.buf: assert b == 0 shm.close() shm.unlink() This indicates that the shared memory segment is all binary zero.
However, what I want to know is whether this is well-defined behaviour across all platforms
SharedMemoryrelies onCreateFileMapping()/OpenFileMapping()calls, in POSIX it callsshm_open().