如果RAM使用量超过指定的量,立即停止MATLAB。有办法吗 [英] Immediately stop MATLAB if RAM usage exceeds a specified amount. Is there a way?
问题描述
基本上,每当我错误地使MATLAB使用大量的RAM进行仿真,我创建了许多参数,我就厌倦了重置我的comp。
如果RAM使用率开始超过我的总内存的指定百分比,是否有办法停止/错误?
我知道我将每个分配内存的地方都放在try / catch中,但是这是一个已经编写的程序,并且为了将来参考,我想能够设置一个参数开始并且完成它。
有没有办法?
谢谢!
您可以为进程组设置虚拟内存配额。在Windows上使用Job对象。在* nix上使用 ulimit
。这与任何流程有关,而不仅仅是MatLab。
请参阅
Title says it all.
Basically, I am getting tired of having to reset my comp every time I mistakenly make MATLAB use a large amount of RAM for a simulation with many parameters I am creating.
Is there a way to make it stop/error out if the RAM usage starts to exceed a specified percentage of my total RAM?
I know that I am put try/catches every where I allocate memory, but this is for a program that is already written, and also, for future reference, I want to be able to just set a parameter in the beginning and be done with it.
Is there a way?
Thanks!
You can set virtual memory quota for a process group. On Windows use a Job object. On *nix use ulimit
. This works with any process, not just MatLab.
See
这篇关于如果RAM使用量超过指定的量,立即停止MATLAB。有办法吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!