Sometimes I get an out of memory exception when I don't think I should. It's been happening when I try to write a file to the hard drive. For analytical purposes I have to have all the data loaded into ram before writing it, and it is several dozen megabytes.
However, I know that I have 16 gigabytes of ram and I'm hardly running any other programs, certainly not anything that would take a significant fraction of it. Isn't memory first-come first-serve, meaning that Windows should let me have however much I need until I've used it all and then run out?
Also, it oddly occurs while I'm writing the file. The data is already in ram, and I'm not allocating any more. I thought that the only thing that could cause that exception was a memory allocation, or am I wrong?
And by the way, I know that the stream and everything is working, because if I use smaller files with the same function, it works fine. The problem only happens when I use a huge file, and it tends to happen late in the process when it's near the end of writing the file.
↧