Unfortunately, it is still a moving target. When I gave the require advice in the cited thread, I was using perl v5.10.0 (64-bit under Vista if memory serves), and it was necessary to require LWP::Simple to avoid leaks.

I just tried the code from that thread on my current setup (perl v5.10.1 64-bit under Vista) and it dies the first time a thread terminates. Moving back to useing LWP::Simple and I get no traps and no memory leaks.

I've limited knowledge of *nix, and I'm not sure if threads actually use COW there. I do know that COW is rarely very effective with Perl in the big picture because even read-only references to perl scalars can cause modifications to the internal representation of the SVs, forcing wholesale, but piecemeal copying of the memory.

You touch one scalar in a 4096-byte of memory (Say: if( $scalar == 0 ) {), and if the scalar contains a PV (string) representation of a number, it must be converted to an NV or IV for the comparison. Then the whole page has to be copied. Sum a large array of numbers (loaded as strings from a file), and the array gets copied in a series of 4k chunks rather than copied as a single large entity in one pass. The result is slower, and can end up using more memory through fragmentation.

Ultimately, with different platforms and different versions having different caveats, the best way is to simply try it for yourself.


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.
"I'd rather go naked than blow up my ass"

In reply to Re: common modules and threads? by BrowserUk
in thread common modules and threads? by perl5ever

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.