Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^4: IPC::Shareable sometimes leaks memory segments

by stevieb (Canon)
on Jul 09, 2019 at 15:51 UTC ( [id://11102605]=note: print w/replies, xml ) Need Help??


in reply to Re^3: IPC::Shareable sometimes leaks memory segments
in thread IPC::Shareable sometimes leaks memory segments

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:

our %hash; $hash{B} = 1;

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11102605]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2024-04-19 19:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found