Out of memory! in Perl program -


sub fetch_ms_table {    $ms_initial_cnt = 0;   $logger->info("begin fetching taccttree_ms");    $sql = "select $pk_string,link_c,length_q,paths_q taccttree_ms tree1 out_z>\"$process_time\"";    &execsql($dbp, $sql);   $cnt  = 0;   $cnt1 = 0;    #load milestone table data   while (@data = $dbp->dbnextrow()) {     $data[0] =~ s/\s+//g;     $taccttree_ms_cache{ $data[0] }{status}   = "d";    #default record deleted.     $taccttree_ms_cache{ $data[0] }{pk}       = $data[0];     $taccttree_ms_cache{ $data[0] }{link_c}   = $data[1];     $taccttree_ms_cache{ $data[0] }{length_q} = $data[2];     $taccttree_ms_cache{ $data[0] }{paths_q}  = $data[3];     $ms_initial_cnt++;   }    $logger->info("end fetching taccttree_ms - fetched $ms_initial_cnt rows"); } 

the above function fails giving below log,

info> main::fetch_ms_table begin fetching taccttree_ms  failed 'milestone taccttree table'  std err  out of memory!  

the sql returns around 5,050,402 rows. same subroutine called twice main program. first time goes through fine , second time fails out of memory

it's little hard tell example since either using global variables or using them without declaring them; previous comment use strict; etc. one.

my thought $dbp variable (which seems contain of results, based on body of execsql) consuming space after each call, , don't have enough free space when second call comes around. suggest making dbp variable in function , clearing out before exit function.


Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -