in reply to Re: Perl Threads
in thread Perl Threads

So taking your suggestions above, I have updated my scipt as seen below and this does seem to resolve my memory issue - MUCH APPRECIATED!

my $running : shared = 0; ###THREADED### ##Parse Fetch and execute DELETE while (@row = $sth->fetchrow_array ) { ##Create and Run threads ##Limit running threads sleep 2 while $running >= $maxThreads; threads->create (\&deleteDevice, @row)->detach; } ##Thread cleanup sleep 1 while $running > 0; sub deleteDevice($) { ++$running; my $deviceSN = shift; my $full_url = "https://$api_creds\@$cwm_url$deviceSN"; &debug("CMD: $full_url"); #my $threadCount = scalar threads->list(threads::running); print "Current Thread Count: $running\r"; # Get current subscriber info my $ua = LWP::UserAgent->new( ssl_opts => { verify_hostname => 0, SSL_verify_mode => 0x0 +0 } ); $ua->agent("Device Deletion"); my $req = HTTP::Request->new(DELETE => $full_url); $req->content_type('application/x-www-form-urlencoded'); my $res = $ua->request($req); if($res->is_success) { &logDeviceDetails("$deviceSN -- Delete Successful"); } else { &logDeviceDetails("$deviceSN -- Delete Failed: " . $res->statu +s_line . " - " . $res->content) } --$running; }