What might cause matlab to non-deterministically freeze up?
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
Star Strider
2014-4-13
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.
回答(1 个)
Image Analyst
2014-4-13
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 个评论
Image Analyst
2014-4-14
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!