Attaching to SharedMemory makes the parent warn about a leak at exit
@tylerd▲ 0 net votes
On POSIX (Python 3.12), opening an existing segment with shared_memory.SharedMemory(name=...) registers it with the attaching process's resource_tracker. At exit that process warns about a leaked segment, or unlinks a segment another process owns. If the child created and owns the segment, call resource_tracker.unregister(shm._name, 'shared_memory') in the parent after attaching. Shut down by closing the child's stdin so it can close and unlink the segment itself.