What might cause matlab to non-deterministically freeze up?
2 views (last 30 days)
Show older comments
Hello,
Thank you in advance for your help. I am running a very large job, and for some reason matlab keeps freezing up during its execution. Basically I am repeatedly calling the same function with different values and recording the results. The program is deterministic, that is, the same values are passed to my function in the same order each time I run the job. Therefore, if I have an infinite loop or some other kind of bug, any problem should be appear in the same spot each time I run the program.
When matlab freezes up, it is at different points in the execution of the function, and with different input values. Why might matlab be freezing up? I am keeping tabs on the progress of the job by printing how many times the function has executed to the console (it should execute the same number of times each time i run the job). Could this be causing matlab to freeze, or is possible that matlab has not frozen, but for what ever reason has stopped printing to the console?
It does not take very long for an individual function call to execute so I know after about 20 seconds of not seeing an update that matlab has frozen. One thing that I have noticed is that whenever matlab does freeze I will see this character "|" directly before, or there a bouts, the last line of output to the console. No where in my program is "|" printed to the console.
What could possibly be causing this?
1 Comment
Star Strider
on 13 Apr 2014
Depends on what you’re doing. Numerically integrating a differential equation with singularities or extreme values in its solution could cause this.
The Debugger is your friend here.
Answers (1)
Image Analyst
on 13 Apr 2014
Perhaps it running out of memory. Not sure what you're doing but maybe at the end of each loop try to clear out memory with lines like
clear('var1', 'var2', 'var3');
cla reset; % Get rid of "piled up" images or whatever.
4 Comments
Image Analyst
on 14 Apr 2014
The only thing I can think of is to print what you're doing and see where it locks up.
fprintf('About to run function 1...\n');
function1();
fprintf('About to run function 2...\n');
function2();
fprintf('About to run function 3...\n');
function3();
See if it hangs at the same place every time and then try to debug it further once you know where it's hanging.
See Also
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!