Skip to main content

prune()

Remove orphaned shared memory regions.

Usage

Source

prune()

Removes the pymizu shared memory regions that dead processes leave behind. This is needed only in exceptional circumstances. Cleanup after a crash is automatic as long as any participant of the pool or channel survives it, because the survivor detects the death and reclaims the dead process’s regions itself. Orphans arise only when every attached process dies at once (for example, the whole process group is killed), so no survivor remains to run that cleanup. They persist until pruned or until the machine reboots.

Regions of running processes are never touched. Do not run this while another pymizu session on the machine is recovering from a crash: values sent by a now-dead peer stay readable by its survivor until consumed, and this function would remove them.

A crashed process cannot clean up after itself, and a new process that happens to reuse its PID cannot reap its orphans either (it reads its own PID as alive). Run prune() while the PID is free, before reuse.

Returns

The region names removed, or an empty list if none were. On
platforms whose shared memory namespace cannot be enumerated (Windows, where orphans cannot exist), always an empty list.