in reply to Problem in RAM usage while threading the program
Perl iThreads runs multiple perl interpreters in the same process, each with their own separate copy of variables. It gives you that "threading feeling" but in some ways it is actually less efficient than just running multiple processes. Perl behaves well with fork(), so if you used a non-threaded perl to allocate the data structure, then fork a bunch of children, Linux will let the processes share any page of ram that hasn't been written and you'll get a lot of memory savings. Also, perl without the iThreads feature compiled into it will run notably faster.