I think I've figured out what's going on. Corrections welcome.
When the child process allocates a new array reference via the push, that reference is automatically tied which causes the creation of a new shared memory segment and a new shared semaphore. See the section on "REFERENCES" in IPC::Shareable. By default, the "destroy" flag for those is off, so when the child exits, those segments live on.
When the parent exits gracefully, since it's "destroy" flag was on, all the shared memory and semaphores created by the parent are deleted. But that does not extend to the segments created by the children.
Adding a call to IPC::Shareable->clean_up_all() at the end of the parent causes all of the segments and semaphores (of both the parent and children) to go away. You would have to add that to the signal handler too.
Adding references to the tied structure is apparently very expensive, in terms of shared resources consumed. It would probably be best to find another way to do it.
In reply to Re: Leaking Semaphores and Shared Memory
by gmargo
in thread Leaking Semaphores and Shared Memory
by jcpunk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |