I think you are barking up the wrong tree looking at %datahash as the cause of the problem.

The following simple script emulated what you are describing and once the 101 threads are up and running, the memory usage is rock steady under both 5.8.6/AS811 with the AS delivered core version of threads and 5.8.8/AS817 with the latest cpan versions of threads & threads::shared. And that's relying upon Perl's garbage collection alone.

More information needed. (I still suspect Data::Dump)

#! perl -slw use threads; use threads::shared; print $threads::VERSION; print $threads::shared::VERSION; print $]; @th = map{ threads->new( sub{ while( 1 ){ local %h = ( 1 .. 10000 ); sleep 1 } } ) } 1 .. 100; $_->join for @th __END__ c:\test>junk9 Name "main::h" used only once: possible typo at c:\test\junk9.pl line +13. 1.05 0.92 5.008006 Terminating on signal SIGINT(2) c:\test>\AS817\perl\bin\perl5.8.8.exe junk9.pl Name "main::h" used only once: possible typo at junk9.pl line 13. 1.1201 0.99 5.008008 Terminating on signal SIGINT(2)

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."

In reply to Re^5: Massive Perl Memory Leak by BrowserUk
in thread Massive Perl Memory Leak by wagnerc

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.