Out of memory! Callback called exit at C:/perl/lib/HTML/Element.pm line 234. Callback called exit at C:/perl/lib/HTML/Element.pm line 234. Perl exited with active threads: 19 running and unjoined 0 finished and unjoined 2 running and detached #### use threads ('stack_size' => 4096); use threads::shared; use threads qw(yield); use Thread::Queue; my $sched = new Thread::Queue; my $parser_thread1 = async { main_loop();}; my $parser_thread2 = async { main_loop();}; my $parser_thread3 = async { main_loop();}; #goes to 20, not elegant but it works $parser_thread1->join; $parser_thread2->join; $parser_thread3->join; #goes to 20 as well sub main_loop { while( schedule_count() and $hit_count < $hit_limit #could be commented out and time() < $expiration and ! $QUIT_NOW ) { yield(); process_url( next_scheduled_url() ); } return; } my $mysql_thread = threads->create('send_parts_to_db', $parts)); $mysql_thread->detach; undef $mysql_thread; #as suggested by someone on perlmonks