0

I would like to dedicate 8 GB of RAM instead of the full (12) for a very long computation, in order to use the remainder for another operation. Is it possible?

Is there maybe a MATLAB command that forces the maximum limit of memory usage?

I would like to work with 2 separate editors.

Adriaan
  • 17,741
  • 7
  • 42
  • 75
Daniele
  • 23
  • 8
  • Make virtual machine with 8gb, put matlab into VM, and run it here. (VirtualBox)[https://www.virtualbox.org/] – Severin Pappadeux Jan 12 '16 at 13:44
  • 2
    If you're using linux, a call to `ulimit` in the terminal process from which you call matlab afterwards, can limit the memory available to matlab. But even then matlab will just give up if it runs out of memory. – Andras Deak -- Слава Україні Jan 12 '16 at 13:44
  • What operating system are you using? if it's linux you can set a limit with ulimit http://unix.stackexchange.com/questions/1424/is-there-a-way-to-limit-the-amount-of-memory-a-particular-process-can-use-in-uni – Lanting Jan 12 '16 at 13:45
  • i'm using windows 8, 12 GB RAM and 64 bit – Daniele Jan 12 '16 at 13:46
  • 4
    Wouldn't that just break matlab? If Matlab needs 10 GB for your computation, wont it just fail if you give only 8GB to it? – erg Jan 12 '16 at 13:49
  • 1
    Why not design your code to not use more memory than wanted. Then you can determine by yourself how to deal with memory problems. Otherwise the program would just crash. – patrik Jan 12 '16 at 15:17

2 Answers2

2

See here for a possible solution on "limit the memory of a process on windows":

Set Windows process (or user) memory limit

Community
  • 1
  • 1
erg
  • 1,632
  • 1
  • 11
  • 23
1

Matlab has no command to limit the memory usage, it will aquire as much memory as needed to do the computation. On some operating systems you can limit the memory usage, for example using ulimit on Linux. But be aware, when Matlab needs more than 8gb it will not be slow when reaching the limit, it will throw an exception and stop computing.

Daniel
  • 36,610
  • 3
  • 36
  • 69