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.
In reply to Re: common modules and threads?
by BrowserUk
in thread common modules and threads?
by perl5ever
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |