Even though the program seems to start many threads, it only keeps three threads open, joining the other threads, and even though the memory it uses keeps going up and up. Try to copy and paste the code in your PC and watch your memory go up even though you are only with 4 threads open.
Thanks,
Paulo C.