http://www.perlmonks.org?node_id=1219458


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".