Everything in your post makes sense to me; however, I have a single threaded version of the program that uses the same amount of memory using both the nested maps and the foreach loop. Also, aren't newer versions of perl optimized such that when map is used in a void context, the extra work that differentiates it from foreach and from for optimized away? (Source: http://www.perlmonks.org/index.pl?node_id=296742)
The threaded version and the single threaded version are basically identical except instead of loading a queue, I call &doWork on the string. If the Thread::Queue was not part of the problem, shouldn't nested map use more memory than the nested foreach loops? From my testing, the outrageous use of memory only occurs when I am using Threads and Thread::Queue, otherwise the two perform similarly.
Thankyou
In reply to Re^2: Thread::Queue memory issue with nested maps but not foreach loops...
by Anonymous Monk
in thread Thread::Queue memory issue with nested maps but not foreach loops...
by jmmitc06
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |