Perl: the Markov chain saw | |
PerlMonks |
Re^4: IPC::Shareable sometimes leaks memory segmentsby stevieb (Canon) |
on Jul 09, 2019 at 15:51 UTC ( [id://11102605]=note: print w/replies, xml ) | Need Help?? |
Getting a bit somewhere. Problem 1: If script dies in main, mem segment leaked... going through the code, there's a %Global_Reg class hash which stashes all shmem and semaphore information. HOWEVER, the segment/semaphores don't get written into this hash until a write operation is performed on the shared variable. So in my main.pl die() test, I was dying before a single write, hence, the %Global_Reg hash isn't populated with the segment ID, and therefore isn't cleaned up in the clean routines. Fix? For now, in B.pm, I've:
B.pm simply writes something to the shared hash immediately after its declared, thereby creating the necessary entry in %Global_Reg, ready for cleanup. Currently, I'm just adding debugging info into the Shareable modules to pinpoint what's happening (and supposed to be happening) when. I'm not making any functional changes until I fully understand the processes. Once I'm confident in how things all hang together, I'll go over my notes and make the relevant changes to improve the functionality of the distribution (well, at least for my needs). At minimum so far, I'll eventually re-write error handling, internal information management, write methods in order to access much more of the internal information (for example, pull an actual shared mem segment object if a user wants to manually blow one away), and specifically, improve the documentation greatly.
In Section
Seekers of Perl Wisdom
|
|