If %branchdata contains references to hashes or arrays, then doing a shallow copy into a key of %datahash will result in the sharing (not in the threads::shared sense!) of the referenced data between the two structures. Eg.
%a = ( 1, {a=>b=>c=>d=>}, 2 =>[ 1..5 ] );; %{ $b{ copy } } = %a;; print Dumper \%a, \%b;; $VAR1 = { '1' => { 'c' => 'd', 'a' => 'b' }, '2' => [ 1, 2, 3, 4, 5 ] }; $VAR2 = { 'copy' => { '1' => $VAR1->{'1'}, '2' => $VAR1->{'2'} } };
To deep copy compound structures, you need to use Clone or (as someone else advised earlier) Storable::dclone().
But whether that has anything to do with your memory growth is impossible to tell from the code shown. If both of these structures are lexical and being garbage collected, then that (shallow copying) should not be the cause the symptoms you are describing.
It sounds like you may be creating some kind of a circular reference somewhere. This could cause the kind of accelerating memory growth you mention. Maybe. But again, it's just guesswork without seeing the code.
And the problem does not seem to be related to your use of threads. Though it is obviously exaggerated by there being 100 times as many 'programs' all doing the same bad thing--whatever that is.
In reply to Re^3: Massive Perl Memory Leak
by BrowserUk
in thread Massive Perl Memory Leak
by wagnerc
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |