foreach counter now must be size_t ?

jmh530 john.michael.hall at gmail.com
Wed Feb 6 22:00:35 UTC 2019


On Wednesday, 6 February 2019 at 21:23:20 UTC, H. S. Teoh wrote:
> [snip]
>
> As you may know, mmap() turns files into arrays (see 
> std.mmfile).  You
> access it just like an array, and the OS maps it to the file 
> for you.
>
> You wouldn't want somebody to pass the array returned by an 
> mmap() call to your code that assumes arrays cannot have length 
> larger than 32-bits -- you'd run into wraparound bugs.
>
> Just because the array has a huge size doesn't necessarily mean 
> you need that much RAM to hold it. The OS pages parts of it 
> in/out as you access it.
>
>
> T

mmap is something that I never really played around much with, 
but it seems like it would be useful for me in some cases. I've 
done some Monte Carlo simulations that end up causing me to run 
out of memory. Doing it as an mmap instead might be slower but at 
least I wouldn't run out of memory.


More information about the Digitalmars-d mailing list