I have the following script (extremley simplified) foreach my $key (sort {$a<=>$b} keys %run){ my $inp; $inp=$dbh->selectall_arrayref("select id, [description] from Kaonix_import_base where idint between ? and ? ",undef,$run{$key}->[0], $run{$key}->[1]) ;
addrec($inp); -- sub to run very heavy regexs against the select and insert into another table undef($inp); } The problem is that memory is not being freed against the statement handle on each iteration and eventually the script stalls due lack of memories any ideas?