in reply to Semaphores leaks with IPC::Shareable

I don't know if you can do this from IPC::Shareable, but you probably need to do something like this:
# Deallocate the shared memory segment when exiting program. shmctl ($segment_id, IPC_RMID, 0); $sem->remove;
update
From the IPC::Shareable docs, it says for the ->destroy method: destroy
If set to a true value, the shared memory segment underlying the data
binding will be removed when the process calling tie() exits
(gracefully)3. Use this option with care. In particular you should
not use this option in a program that will fork after binding the
data. On the other hand, shared memory is a finite resource and should
be released if it is not needed. The default is false

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

Replies are listed 'Best First'.
Re^2: Semaphores leaks with IPC::Shareable
by losgrandes (Initiate) on Oct 22, 2014 at 14:38 UTC
    IPC::Shareable takes care of creating semaphores and destroying them. At least should. Well, looks like I missed that part from docs, somehow. Thanks for pointing out. I'll check it without destroy and let you know.
      The docs for destroy says that:
      Use this option with care. In particular you should not use this option in a program that will fork after binding the data.

      You fork.


      I'm not really a human, but I play one on earth.
      Old Perl Programmer Haiku ................... flash japh