out of memory error
2 ビュー (過去 30 日間)
古いコメントを表示
Hi,
I ran a large Monte-Carlo simulation using a loop on a script (not function). After several iterations I got a Out Of Memory error message. I saved the workspace, restarted MATLAB, loaded the saved workspace and modified the loop variable to complete remaining iterations and got the result.
How MATLAB handled this kind of scenario? Why didn't I get any error message when the simulated the remaining segments as I loaded same variables into the RAM?
I need to understand the process badly as I have several other similar simulations to run. Is there any simpler way to get rid of the problem?
5 件のコメント
Walter Roberson
2013 年 9 月 1 日
Memory fragmentation can often be considerably reduced by pre-allocation. If you currently expand any matrix (or vector) within a loop, change that to pre-allocate if you can (and otherwise switch to algorithms that allocate in chunks instead of one row at a time.)
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!