PyDocs

Nav

Concurrent Execution

SharedMemoryManager

  • SharedMemoryManager([address[, authkey]])
Like SyncManager but uses SharedMemoryServer instead of Server.

It provides methods for creating and returning SharedMemory instances
and for creating a list-like object (ShareableList) backed by shared
memory.  It also provides methods that create and return Proxy Objects
that support synchronization across processes (i.e. multi-process-safe
locks and semaphores).
Members of SharedMemoryManager

s

ShareableList
Returns a new ShareableList instance populated with the values from the input sequence, to be tracked by the manager.
SharedMemory
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
0 Notes
No notes for SharedMemoryManager