in reply to Re: Re: A Memory Leak in Perl iThreads?
in thread A Memory Leak in Perl iThreads?

Change:
$thr{"FREE_HOST"} = threads->create("blast_thread");
to:
threads->create("blast_thread"); $thr{"FREE_HOST"} = 1;
Seems you've stumbled on yet another way to make threaded Perl leak. Judging by the amount of memory leaked, it would seem that your way of doing it, doesn't release the memory used by the thread.

I'll be filing a bug report for this to p5p. Until then, I would say: don't do it that way. Why aren't you using a shared scalar for the flag?

Also, if you want to check whether a thread is still running, you might want to check out Thread::Running. And possibly Thread::Pool might also be of interest to you.

Liz

Replies are listed 'Best First'.
Re: Re: Re: Re: A Memory Leak in Perl iThreads?
by cav (Initiate) on Mar 21, 2004 at 16:43 UTC
    Liz, Thanks.. I have to use a hash since I am controling many computers, and each key of my hash controls a computer. Therefore, when the node returns, I need to know its done so I can send more work. I will check out the modules sugested. I was really worried if there was something wrong with my code but as you mentioned, it really seems to be a leak in the perl threads...If there is any other work around please keep me posted,
    Thanks,
    Paulo Carvalho