grondilu has asked for the wisdom of the Perl Monks concerning the following question:
I used to import File::Map to handle a file as if it was a normal scalar variable and it used to work fine. Yet recently I encountered a memory allocation error.
perl -wE 'use File::Map q(map_file); map_file my $f, q(bigdatafile);'
Could not map: Cannot allocate memory at -e line 1.
The only difference I see is that the file is quite large: about 2Go, and I have about 1Go of RAM + 2Go Swap.
Yet I don't understand why this should be an issue. map_file is not supposed to load the whole file in memory, is it?
I also noticed that there is a more standard perl module called Sys::Mmap that does the same thing. But it also gave me a memory allocation error.
What is the proper way to tie a large file to a scalar variable?
Back to
Seekers of Perl Wisdom