Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re^2: PL_strtab/SHAREKEYS and copy-on-write leak

by sezal (Novice)
on Jul 30, 2018 at 08:14 UTC ( #1219458=note: print w/replies, xml ) Need Help??

in reply to Re: PL_strtab/SHAREKEYS and copy-on-write leak
in thread PL_strtab/SHAREKEYS and copy-on-write leak

sundialsvc4, in my code sample %h in parent get destroyed and not accessible in child. The only purpose of it is to preallocate more memory for PL_strtab and make copy-on-write issue more noticeable.

The problem that PL_strtab is shared data structure (not %h). It's solely controlled by Perl and there is no way to control it or use IPC::Shareable or any other well-known for me CPAN modules.

Real life example:
  1. In apache/mod_perl, Starman or any other prefork environment everybody tries to preload as much as possible modules in parent process. Right?
  2. If any of preloaded modules creates hash (even temporary) with big number of keys Perl silently allocates more and more memory for internal PL_strtab hash.
  3. PL_strtab silently get touched in children on any attempt to use hashes.
  4. Problem even worse, because huge percentage of modules we preload are CPAN modules -> there is no way to know which of them overuse hashes resulting in increased memory footprint of parent process.
Thanks everybody for replies. I'm with Perl for over 15 years and PL_strtab issue was not obvious for me and I assume not obvious for majority of Perl developers. I expected and still expect to get suggestion/ideas that would help others as well. I definitely didn't expect that my first post to be considered "garbage".
  • Comment on Re^2: PL_strtab/SHAREKEYS and copy-on-write leak

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2020-10-30 17:12 GMT
Find Nodes?
    Voting Booth?
    My favourite web site is:

    Results (282 votes). Check out past polls.