Put a limit on Memory Matlab Uses

조회 수: 11 (최근 30일)
Blaine
Blaine 2011년 7월 29일
This morning I froze our local workstation with Matlab while error testing my code. I accidentally created variables requiring large amounts of memory (>100GB) while the workstation only has 50GB to utilize. The 64bit 2009A Matlab does not give the usual 'out of memory' response other computers will, but instead I believe it tries to use hard-disk space to create all the variables. The computer runs Windows Server 2008.
Is there a way to limit the amount of memory used by Matlab so that there is, say always at least 2 GB of memory available for the user?
Thanks Blaine

채택된 답변

Jason Ross
Jason Ross 2011년 7월 29일
The behavior you are seeing is a result of Windows trying to "be nice" and allocate the memory you have requested. Since you have a 64-bit address range, it will try as hard as it can to satisfy your request .... although when things are swapped out to disk, they get really slow.
I am not aware of a way to limit an application's memory usage on Windows. I checked Group Policy and found nothing there, I would think that is where you would be able to control such a thing.
A way you could limit this type of behavior is to set your page file size to a certain amount. This way, instead of Windows trying to grow the page file size automatically, it would stop and you would likely get the out of memory error.
  댓글 수: 2
Blaine
Blaine 2011년 7월 29일
Right now, the total memory (physical + swap) is 84 GB, 34 GB over the physical memory. However, why does Matlab recommend a high amount of swap space (2x physical memory) in the documentation ? Obviously they should realize that it's mind numbingly slow...
Jason Ross
Jason Ross 2011년 7월 29일
2X RAM is an old "rule of thumb". There is no right answer. If you want to come up with a better amount, you can monitor how much swap gets used in normal usage of the machine and set the size accordingly.
http://support.microsoft.com/kb/889654

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by