treebeard has asked for the wisdom of the Perl Monks concerning the following question:
I have opened a large (72 mb) file that i am parsing and loading into a hash. I then sort the hash and write it to a new text file. In the process I am receiving the following system error:
Out of memory during request for 1016 bytes, total sbrk() is 670351204 bytes!
Is this a memory leak? I have run this process over and over successfully but now all I receive is this error. Here is the code:
while (<DATAFILE1>) { chomp; ($account,$time,$dept,$dimset,$sched,$emp,$type,$val) = split( +/[{]/); $emp = empnumber ($emp); push(@{$employee{$dept.$account.$emp.$subctr}},($account,$time +,$dept,$dimset,$sched,$emp,$type,$val)); $subctr++; } close(DATAFILE1); foreach $empnum (sort keys(%employee)) { my ($account,$time,$dept,$dimset,$sched,$emp,$type,$val)= @{$em +ployee{$empnum}}; string2 = $account."{".$time."{".$dept."{".$dimset."{"."SchHead +Cnt"."{".$emp."{".$type."{".$val; write(OUTPUT2); } close(OUTPUT2); sub empnumber { my ($number) = @_; my $newnumber; if ($number < 10) {$newnumber = E00.$number} elsif ($number < 100) {$newnumber = E0.$number} else {$newnumber = E.$number} return $newnumber; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Out of memory Error
by Ovid (Cardinal) on Aug 15, 2002 at 16:57 UTC | |
|
Re: Out of memory Error
by Abigail-II (Bishop) on Aug 15, 2002 at 17:04 UTC | |
|
Re: Out of memory Error
by dws (Chancellor) on Aug 15, 2002 at 17:44 UTC | |
|
Re: Out of memory Error
by demerphq (Chancellor) on Aug 15, 2002 at 18:08 UTC | |
by treebeard (Acolyte) on Aug 15, 2002 at 18:33 UTC | |
by demerphq (Chancellor) on Aug 15, 2002 at 19:00 UTC | |
|
Re: Out of memory Error
by abitkin (Monk) on Aug 15, 2002 at 17:13 UTC |