in reply to Memory issue while opening and reading a file

Nothing to do with RAM, well, assuming you are not using something like 16-bit DOS anyway.
Operating Systems like Windows NT and onwards, UNIX, Linux, use virtual memory. On a 32-bit OS the largest address is 2**32, which gives a process address space of 4Gb. That sounds OK!
No, kernel reserves a large slice for itself. On 32-bit Windows that is 2Gb (unless you use a thing called Address Windowing Extensions).
Now, Perl uses the heap, which (on Windows) is again restricted, and a maximum is set at compile time. The default size on Microsoft Visual Studio (last time I looked) is only 1Mb. Details on Linux/UNIX differ, but the jist is the same.
If you were using 64-bit you might be able to get away with it, but somehow I doubt it.

  • Comment on Re: Memory issue while opening and reading a file

Replies are listed 'Best First'.
Re^2: Memory issue while opening and reading a file
by philipbailey (Curate) on Apr 03, 2009 at 14:33 UTC
    Don't forget that one byte in the file does not equate to one byte in memory here. I have seen figures quoted of a factor of 5-10 times overhead for Perl data.