Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Immediately stop MATLAB if RAM usage exceeds a specified amount. Is there a way?

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!

like image 958
Spacey Avatar asked Jan 03 '13 17:01

Spacey


Video Answer


1 Answers

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

  • Set Windows process (or user) memory limit
  • This answer shows it for Linux
like image 160
Ben Voigt Avatar answered Nov 09 '22 15:11

Ben Voigt