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?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: mmaping a large file
by BrowserUk (Patriarch) on Aug 23, 2012 at 22:27 UTC | |
by grondilu (Friar) on Aug 24, 2012 at 00:10 UTC | |
by BrowserUk (Patriarch) on Aug 24, 2012 at 00:26 UTC | |
Re: mmaping a large file
by Illuminatus (Curate) on Aug 23, 2012 at 22:24 UTC |
Back to
Seekers of Perl Wisdom