---
source: https://iinventedlight.com/library/notes/python-shared-memory.md
title: "Python multiprocessing.shared_memory: share a memory block across processes"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "PSF License Version 2 (Python Software Foundation); PSF License Version 2 (CPython); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: Python Software Foundation, multiprocessing.shared_memory — Shared memory for direct access across processes; CPython, multiprocessing.shared_memory documentation (source). PSF-2.0 (https://docs.python.org/3/license.html). Copyright Python Software Foundation."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-26
status: published
approved_by: "Cole Withington, 2026-11-27 14:30 PT: \"Yes, publish all of that now\""
checked_on: 2026-11-26
as_of: 2026-11-26
confidence: medium
untested: "Not reproduced (2026-11-26). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-python: python-shared-memory"
tags: [python, multiprocessing, shared-memory, SharedMemory, ShareableList]
client: Librarian
sources:
  - id: S1
    title: "multiprocessing.shared_memory — Shared memory for direct access across processes"
    publisher: Python Software Foundation
    url: https://docs.python.org/3/library/multiprocessing.shared_memory.html
    accessed: 2026-11-26
    license: "PSF License Version 2"
  - id: S2
    title: "multiprocessing.shared_memory documentation (source)"
    publisher: CPython
    url: https://raw.githubusercontent.com/python/cpython/main/Doc/library/multiprocessing.shared_memory.rst
    accessed: 2026-11-26
    license: "PSF License Version 2"
---
# Python multiprocessing.shared_memory: share a memory block across processes
**Answer:** This module provides a SharedMemory class for allocating and managing shared memory that processes can access.

## What this module means by shared memory

In this module, shared memory refers to POSIX style shared memory blocks, not to distributed shared memory.

Distinct processes can read and write a common region of volatile memory.

Each shared memory block is assigned a unique name.

SharedMemoryManager, a BaseManager subclass in multiprocessing.managers, helps manage the life cycle across processes.

## Starting a manager and cleaning up

Calling start on a SharedMemoryManager instance starts a new process.

Calling shutdown on that instance releases the blocks the process manages.

Use unlink when you need to delete the underlying shared memory block.

ShareableList offers a list-like view of shared memory, with a known issue for bytes and str values.

## See also

- [python-multiprocessing](https://iinventedlight.com/library/notes/python-multiprocessing/)
- [python-mmap](https://iinventedlight.com/library/notes/python-mmap/)
- [python-ctypes](https://iinventedlight.com/library/notes/python-ctypes/)

## Claims

- id: C1
  claim: Each shared memory block is given a unique name.
  source: S1
  evidence: "Each shared memory block is assigned a unique name."

- id: C2
  claim: Starting a SharedMemoryManager starts a new process.
  source: S1
  evidence: "A call to start() on a SharedMemoryManager instance causes a new process to be started."

- id: C3
  claim: The object remains the same shared object.
  source: S2
  evidence: "Note, that it will still be the same shared object."

- id: C4
  claim: Use unlink to delete the underlying shared memory block.
  source: S1
  evidence: "Delete the underlying shared memory block"

## Sources

- [S1] multiprocessing.shared_memory — Shared memory for direct access across processes. Python Software Foundation. https://docs.python.org/3/library/multiprocessing.shared_memory.html . License: PSF License Version 2. Accessed 2026-11-26.

- [S2] multiprocessing.shared_memory documentation (source). CPython. https://raw.githubusercontent.com/python/cpython/main/Doc/library/multiprocessing.shared_memory.rst . License: PSF License Version 2. Accessed 2026-11-26.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Python Software Foundation, multiprocessing.shared_memory — Shared memory for direct access across processes; CPython, multiprocessing.shared_memory documentation (source). PSF-2.0 (https://docs.python.org/3/license.html). Copyright Python Software Foundation. Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
