|
|
| Do you know where your variables are? | |
| PerlMonks |
Re^3: Perl detached threads, loops & my?by rjt (Friar) |
| on Jun 09, 2010 at 00:27 UTC ( #843769=note: print w/ replies, xml ) | Need Help?? |
|
Thank you for the example. However, I still have doubts. Please carefully consider this reply, my other reply, and BrowserUk's comments. Red flag for me: Your second script, you claim takes "HOURS" to run. On the below mentioned old system, that script completes for me in minutes. Process memory usage never went above 50MB.
You're trying to create 100000 threads. You invite a race condition where your script may hit a wall very quickly if your threads do anything non-trivial. You would expect to see:
Your first example will "leak" memory in the sense that the @thr_ll array will grow to 100000, even after threads exit. On most systems this wouldn't be a big deal if your real application caps at 100000 as well, but I still wouldn't recommend it. I ran both of your scripts on my oldest machine, and neither one had a deleterious effect on Perl 5.10.1 on Ubuntu, running on an 8 year old P4-1.6GHz machine with 512MB. Both ran to completion.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||