Prev: Building path form Nx3 array (coordinates)
Next: matlab opengl figure performance: how to use hardware acceleration
From: cabrego on 18 Jun 2010 13:53 I've run into memory problems when executing my matlab code, my code crashes after a few uses even after I have cleared variable and clc'd. My problem requires analysis of a significant amount of image data and I usually have several very large arrays (1500x6000 doubles or logical) . My current problem - after I excecute my code a few times, the maximum array steadily shrinks until it is so small that I can not execute the same basic function exact code. At least that is my current assumptioin after reveiwing a few memory outputs. After each execution, i clear the variables and clc. Usually, I run the code several times because i am changing a threshold variable value-my work around has been to restart matlab when the code crashes due to memory errors. Today I decided to be try to better understand what is going on and try to improve my code/method if possible. If I can bring back my Max possible array to the value after I restart matlab (1370 MB) after every execution, that would be great! Immediately After code crashed and saw Memory Error: Maximum possible array: 122 MB (1.277e+008 bytes) Memory available for all arrays: 494 MB (5.184e+008 bytes) Memory used by MATLAB: 1108 MB (1.162e+009 bytes) Physical Memory (RAM): 2046 MB (2.145e+009 bytes) Immediately After Restarting Matlab: Maximum possible array: 1370 MB (1.437e+009 bytes) Memory available for all arrays: 1561 MB (1.637e+009 bytes) Memory used by MATLAB: 245 MB (2.565e+008 bytes) Physical Memory (RAM): 2046 MB (2.145e+009 bytes) After running code successfully after restart, no clear all clc: Maximum possible array: 177 MB (1.859e+008 bytes) Memory available for all arrays: 447 MB (4.687e+008 bytes) Memory used by MATLAB: 1265 MB (1.326e+009 bytes) Physical Memory (RAM): 2046 MB (2.145e+009 bytes) After running code successfully after Restart and after ‘clear all’ ‘clc’: Maximum possible array: 465 MB (4.876e+008 bytes) Memory available for all arrays: 1454 MB (1.525e+009 bytes) Memory used by MATLAB: 258 MB (2.702e+008 bytes) Physical Memory (RAM): 2046 MB (2.145e+009 bytes) |