I wanted to build an awesome place for people to discuss module specific issues, but I don't have any more time for this, and there are much better places to discuss Perl-related issues. I'd recommend asking your question on Stack Overflow or on Perl Monks.
If you are looking for a Perl tutorial or Perl-related news, I hope these links will serve you well.
Posted on 2010-04-01 08:36:23.219983-07 by tetley
Memory
Hi again, I don't have specifics yet. But it seems memory usage is accumulating if I create & finish a bunch of threads. It's like finished and/or killed and/or exited threads never get freed. I've got to the tune of 5000 of them--most of them finished. The memory footprint grows and eventually it crashes--you know the drill. I reuse the same variable for my thread over and over again. e.g.
$my_th = threads->create(\&something); $my_th->detach(); [it finishes] [some semaphore or kill in place here to guarantee the first one is done] $my_th = threads->create(\&something); $my_th->detach(); [repeat]
I noticed when I don't detach it I get "finished and unjoined: 5000". I would have expected that if it's finished and detached, the handle would be freed. Maybe some basic information is retained so that threads-is_running() or is_detached() works, but I am reassigning the variable. As far as I'm concerned, it's gone. I've tried this with threads-exit(), threads-kill('KILL'), threads-kill('KILL')-detach(), and just plain return, and that's the part I haven't isolated yet. Yes, I do a:
$SIG{'KILL'} = sub { threads->exit(); };
in my threads when I attempt a kill.
Direct Responses: 12615 | Write a response