I'm getting a memory issue I can't seem to understand.
I'm on a windows 7 64 bit machine with 8GB of memory and running a 32bit python program.
The programs reads a 5,118 zipped numpy files (npz). Windows reports that the files take up 1.98 GB on disk
Each npz file contains two pieces of data: 'arr_0' is of type np.float32 and 'arr_1' is of type np.uint8
The python script reads each file appends their data into two lists and then closes the file.
Around file 4284/5118 the program throws a MemoryException
However, the task manager says that the memory usage of python.exe *32 when the error occurs is 1,854,848K ~= 1.8GB. Much less than my 8 GB limit, or the supposed 4GB limit of a 32bit program.
In the program I catch the memory error and it reports: Each list has length 4285. The first list contains a total of 1,928,588,480 float32's ~= 229.9 MB of data. The second list contains 12,342,966,272 uint8's ~= 1,471.3MB of data.
So, everything seems to be checking out. Except for the part where I get a memory error. I absolutely have more memory, and the file which it crashes on is ~800KB, so its not failing on reading a huge file.
Also, the file isn't corrupted. I can read it just fine, if I don't use up all that memory beforehand.
To make things more confusing, all of this seems to work fine on my Linux machine (although it does have 16GB of memory as opposed to 8GB on my Windows machine), but still, it doesn't seem to be the machine's RAM that is causing this issue.
Why is Python throwing a memory error, when I expect that it should be able to allocate another 2GB of data?