http://www.perlmonks.org?node_id=970812


in reply to Expected speed of retrieve function (nstore retrieve)

perl -e'$x[$_]=42 for 1..40_000_000; <>'
already needs around 1.5GB memory on my machine, and
perl -e'$x[$_]="foo" for 1..40_000_000; <>'

takes 3.3GB (checked with top).

So depending on what exactly you have in your array, and whether the process of retrieving involves making another copy of the data on the stack (not that unlikely, though I haven't checked), and what else you have running on your machine, you might well be running out of physical memory...