As others have said, jamming 3G of data into 1G of ram is going to be problematic ... especially since you're doubling your amount of memory by reading the file into memory first. I would recommend:
open( my $fh, "<", $sigDataFile ) || die( "cannot open file - $!" ); while( <$fh> ) { chomp; my( $key, $value ) = split(/=/, $_); # does = need to be escaped? ... }
use Fcntl; use SDBM_File; tie( %hash, 'SDBM_File', 'temp_file_name', O_RDWR|O_CREAT, 0666 ) or die "Couldn't tie SDBM file 'filename': $!; aborting"; open( my $fh, "<", $sigDataFile ) || die( "cannot open file - $!" ); while( <$fh> ) { chomp; my( $key, $value ) = split( /=/, $_ ); $hash{$key} = $value; ... }
In reply to Re: Memory issue while opening and reading a file
by derby
in thread Memory issue while opening and reading a file
by koti688
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |