KekLib.OurMultiprocessing#

temporary investigation to a suspected bug of multiprocessing.shared_memory

class SharedMemory(name=None, create=False, size=0)#

Bases: object

Creates a new shared memory block or attaches to an existing shared memory block.

Every shared memory block is assigned a unique name. This enables one process to create a shared memory block with a particular name so that a different process can attach to that same shared memory block using that same name.

As a resource for sharing data across processes, shared memory blocks may outlive the original process that created them. When one process no longer needs access to a shared memory block that might still be needed by other processes, the close() method should be called. When a shared memory block is no longer needed by any process, the unlink() method should be called to ensure proper cleanup.

property buf#

A memoryview of contents of the shared memory block.

close()#
property name#

Unique name that identifies the shared memory block.

property size#

Size in bytes.

Requests that the underlying shared memory block be destroyed.

In order to ensure proper cleanup of resources, unlink should be called once (and only once) across all processes which have access to the shared memory block.