0

Sometimes when you ask matlab to create a very large array, it exceed actual ram and tries to go into harddisk, which slows down the computer so much that it becomes impossible to close matlab, only choice is to use the power button.

I want to disable only matlab's access to harddisk ram.

There are two related questions with nothing really that useful:

https://www.mathworks.com/matlabcentral/answers/34923-limiting-matlab-memory-usage

https://www.mathworks.com/matlabcentral/answers/231870-quitting-matlab-unresponsive-due-to-memory-maybe

0

Sometimes when you ask matlab to create a very large array, it exceeds actual ram and tries to go into harddisk, which slows down the computer

Uhh, sort off. What actually happens is that windows doees not assign RAM. It assign virtual address space (as you can see in the commit charge).

When it needs to use this asigned space it will try to use free RAM.
If there is no free RAM then it will try to free some. E.g. by writing some information from memory to the pagefile.

Tis is not an per application situation, but something with all memory usage on the system.

so much that it becomes impossible to close matlab, only choice is to use the power button.

The most likely problem here is that you have one application which triggers a lot of diskIO. That disk is shared by other applications and the OS. Which means that the OS also slows down.

Solutions:

  • Somehow limit matlab to have capped memory. Job objects might do the trick, though I never used it.
  • Or get much faster IO. (mitigates IO slow down).
  • or run matlab in a VM (you can limit the VMs memory).
  • I mean, I would be fine with just matlab crashing, as long as I can kill the process without the power button. The solutions you have written seem too difficult to me and I'm kinda mad at matlab because the hard disk ram schtick clearly doesnt work. – grdgfgr Jul 31 '15 at 14:58
  • 1) Looks non trivial. 2) Is the same as @cybernards answer. (more generically formaulated). 3) A VM is what I would do. 4) Nice to have would be lower priority for matlab. That MIGHT help. Sadly I have no found anything bar CPU priorities in windows and I suspect that disk IO priorities could help here. ALl in all I would either be aware of how much memory I used and not exceed it. Our buy more memory if I often exceeded it by an affordable amount. Or go safe and run it in its own VM. (Virtual box and vmware player are free, though you would need a legal OS). – Hennes Aug 2 '15 at 9:08
0

This will help will IO contention.

  1. Get an SSD which has 5x or more the IO.
  2. Add a second hard drive and move the swap file to it (The OS and swap file will never share IO this way)
  3. Both 1 & 2

Defragging will help slightly, but not work any miracles.

Turning off or limiting the windows swap file will cause windows to become slow and ugly.

  • 1
    Some nice to have background: Turning off swap (or rather, paging since we have not used swap in ages) means that the usignable virtual adress space equals ream address space (aka RAM). That means no paging out of unused data, thus less free memory and fewer disk buffers. I assume the last if the main cause for the slow downs. – Hennes Aug 2 '15 at 9:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.