
koti688
Novice
Apr 3, 2009, 5:06 AM
Post #1 of 19
(13493 views)
|
Memory issue while opening and reading a file
|
Can't Post
|
|
Hi Monks, i am facing memory issue while opening and reading the contents of a file. My Script is below.
my $sigDataFile = getValueFromPath($event ,"data/file"); open(TEST,"<$sigDataFile") || die("This file will not open!"); my @records = (); @records = <TEST>; chomp @records; close(TEST); my @keys; my @values; foreach my $rec(@records) { my ($key,$value)=split(/\=/,$rec); push @keys,$key; push @values,$value; } My $sigdata file is a flat text file about 3 Gb which has a format of key=value on each line , like below. <key>=<value> <key>=<value> <key>=<value> <key>=<value> <key>=<value> ........ ........ ........ <key>=<value> <key>=<value> <key>=<value> <key>=<value> <key>=<value> While i run my script on command prompt. it says like "Out of Memory".Can you please tell me , is there any fault in my script while opening and reading the contents of the file. My System details are like Pentium(R) 4 CPU 2.26 GHz 1.00GB of RAM. Thanks in advance You can reply Your suggetions on koti688@gmail.com
|