如果RAM使用量超过指定的量,立即停止MATLAB。有办法吗 [英] Immediately stop MATLAB if RAM usage exceeds a specified amount. Is there a way?

查看:150
本文介绍了如果RAM使用量超过指定的量,立即停止MATLAB。有办法吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

标题说了一切。



基本上,每当我错误地使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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆