Stop MATLAB when not enough memory
6 ビュー (過去 30 日間)
古いコメントを表示
I use Window 10 64 bit, 24 GB RAM, MATLAB R2016a. In occasion when I run data with big size, memory is full 100%. The computer is hang and it is unable to close MATLAB or do anything else but restart.
My question is how to avoid this issue. For example if there is an pop-up to quit program when memory is full 100%, or some warning of full memory. It will allow me to reduce data size before running, or clear unused data... instead of restart the hung computer as I must do right now.
Thank you.
1 件のコメント
KSSV
2016 年 9 月 29 日
There is an option to check memory in matlab. Doc memory. You can check how much memory is left and put some limit on your own, and using if statement you can either exit matlab or break/ stop the code. But, I don't think this is the solution for the problem.
回答 (1 件)
Walter Roberson
2016 年 9 月 29 日
One thing that can help is to use Preferences -> Workspace and enable "Limit the maximum array size to a percentage of RAM" and choose a size there.
When you have that in effect, it does not control the total memory to be used, but when you ask to create or assign into an array and that would make that particular array larger then the limit you set, then MATLAB would throw an error.
This will not deal with the issue of just accumulating enough variables in total that the memory fills up. For example if you limit to 75% but then build 7 variables each of which fills up 15% of memory, you would still run out of memory (7*15% = 105%).
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!