PyDocs

Nav

Concurrent Execution

SharedMemoryManager.SharedMemory

  • SharedMemoryManager.SharedMemory(size)
Returns a new SharedMemory instance with the specified size in
bytes, to be tracked by the manager.
1 Example
>>> from multiprocessing.managers import SharedMemoryManager
>>> smm = SharedMemoryManager()
>>> smm.start()  # Start the process that manages the shared memory blocks
>>> sl = smm.ShareableList(range(4))
>>> sl
ShareableList([0, 1, 2, 3], name='psm_6572_7512')
>>> raw_shm = smm.SharedMemory(size=128)
>>> another_sl = smm.ShareableList('alpha')
>>> another_sl
ShareableList(['a', 'l', 'p', 'h', 'a'], name='psm_6572_12221')
>>> smm.shutdown()  # Calls unlink() on sl, raw_shm, and another_sl
from the Python docs
See Also
No see-alsos for multiprocessing.managers/SharedMemoryManager.SharedMemory
0 Notes
No notes for SharedMemoryManager.SharedMemory