The stupid question is the question not asked | |
PerlMonks |
IPC::Shareable sometimes leaks memory segmentsby stevieb (Canon) |
on Jul 08, 2019 at 20:42 UTC ( [id://11102569]=perlquestion: print w/replies, xml ) | Need Help?? |
stevieb has asked for the wisdom of the Perl Monks concerning the following question: Hi all, So I've been working on a shared memory issue I'm trying to incorporate into one of my more complex distributions, and finally decided to ask for help. I've dumbed it down the best I can to replicate the problem in the minimum amount of code possible. Code layout. A.pm contains the creation of the shared hash, I then expose the hash with our() in A.pm (and import it into B.pm). The calling script is main.pl:
Here's a listing of how to run the code to produce the relevant outcomes:
Here's my cobbled together example code: A.pm
B.pm
main.pl
Oddly, if I run the problematic line (perl main.pl 2 2 2) more than once, only the first segment remains in ipcs -a. I would think it'd stash another entry, as it's based on procID. In my real project, I need to catch SIGINT, die() and a myriad of other things to ensure that the shared memory segments get cleaned up appropriately in some quite complex situations, but I think if I can get help sorting out why things aren't working here, I should be able to fix the real problem. Can anyone help me sort out why IPC::Shareable isn't cleaning up properly? If more information is needed, please don't hesitate to say so. Note:
Another note: If I run the problematic run (perl main.pl 1 1), then run a full good run (perl main.pl 2 2), the previously leaked segment is cleaned up. This is what is very confusing to me.
Back to
Seekers of Perl Wisdom
|
|