in reply to Expected speed of retrieve function (nstore retrieve)
already needs around 1.5GB memory on my machine, and
perl -e'$x[$_]=42 for 1..40_000_000; <>'
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...