.. class:: SharedMemoryManager([address[, authkey]])
+ :module: multiprocessing.managers
A subclass of :class:`~multiprocessing.managers.BaseManager` which can be
used for the management of shared memory blocks across processes.
.. doctest::
:options: +SKIP
- >>> from multiprocessing import shared_memory
- >>> smm = shared_memory.SharedMemoryManager()
+ >>> from multiprocessing.managers import SharedMemoryManager
+ >>> smm = SharedMemoryManager()
>>> smm.start() # Start the process that manages the shared memory blocks
>>> sl = smm.ShareableList(range(4))
>>> sl
.. doctest::
:options: +SKIP
- >>> with shared_memory.SharedMemoryManager() as smm:
+ >>> with SharedMemoryManager() as smm:
... sl = smm.ShareableList(range(2000))
... # Divide the work among two processes, storing partial results in sl
... p1 = Process(target=do_work, args=(sl, 0, 1000))