You'll never get this to work right. Consider use forks or building some long running worker threads. Ultimately you'll never really be happy with threads in Perl (just a guess). Some people use them. Another option is Coro. Might be better.
-Paul
Comment on Re: Perl threads memory leak with socket and solutions I tried...
Thanks. I tried forks. When I start the program, it will create 2 processes. One of the process, the child process, still has memory leak problem, although the memory increases very slowly.