I am running 32b vista, Matlab 2009a. The machine has 4GB of RAM installed, PAE & 3G switch activated. the machine is dedicated to MATLAB and doesn't run anything else.
I have code that reads and writes data from disk. Data is stored in the form of txt files. There are thousands of text files around 200MB each in size. The code loads the text file into RAM processes it and then writes it back to disk.
Each load is done within a loop
for i = 1: numFiles
clear file (and all other variables I can see lurking around)
hence any RAM intensive processes are done in loadAndWriteData.m This returns on each call of the for loop.
I use memory.m to inspect the memomry availble to me. I see that after a few runs around the available memory starts dropping off. Then Matlab crashes with an out of RAM error.
I would have thought that as the function is returning each time around the loop, I would be nicely clearing everything in RAM.
What I am doing wrong? Any help gratefully received. thank you.