How to fix out of memory error in matlab

This article gives you a solution to solve the Out of Memory error in Matlab

Many users get out of memory error while either using Matlab or Simulink. This can be frustrating and there is useless solution posted in Matlab forum and anywhere else. In this article we want to share how to fix Out of Memory Error in Matlab can be solved.

Matlab recommends Strategies for Efficient Use of Memory in their support section on their webpage. It discusses various techniques for solving this problem. Sometimes they work and sometimes they won’t work. Many users claims that they have sufficient RAM memory and applying suggestion by Matlab didn’t help.

So here in one way you can fix the out of memory error in Matlab. The solution is install Windows Server 2012 or other versions in a Virtual Machine. Then install Matlab into the Virtual machine operating on Windows Server. You can download and install virtualBox which is for free.

The reason why this solution works is that Windows server Operating System does not install all the User Interfaces programs like in Windows 7 or Windows 8 or 10. It installs minimal windows user interfaces programs. So when you are using windows 7 for example, there are lots of background services and process running which will claim processor time and memory. Thus Matlab will generate out of memory errors.

Using Task Manager to kill processes and application that you don’t need while running Matlab should help to certain extent but does not as per people experience. The reason behind killing the processes and programs is to free up processor time and free up memory. Ideally, this should have worked but doesn’t. People also increase their default RAM size but it is reported that this does not help either.

By using Matlab on Windows server OS running inside Virtual Machine the processes and application will be minimal. And you can configure how many processor to dedicate to Virtual Machine. For example, in this report, VMware was used as virtual machine system and Windows 2012 server Operating System was used. Then once you have installed the Windows Server into VMware you can set the number of processors to be used for the Virtual Machine. In this report i5 intel processor was used and there are four processors in this system. By setting Virtual Machine to use 3 processors Matlab program and Simulink did not issue Out of Memory Error which it did previously. A screenshot of how to set the number of processors in VMware is shown below.

fixing matlab out of memory error using virtual machine

The next thing you might want to try to improve performance is to set the memory to 2GB from default 1GB as shown in the figure below.

solving out of memory error in matlab simulink

Now Matlab Simulink should be working fine and does should not report any out of memory error.

The Operating System used in this report was 32-bit windows 7. VMware was used as virtual machine and windows 2012 server was used as the operating system.

Also for better performance we suggest to not install any other programs/application into the Virtual Machine/Windows server. That is the virtual machine/windows server should be dedicated to running matlab.

Hope this helps you if you are having Out of Memory error problem with Matlab Software. Let us know via comment if this trick worked for you.

Leave a Reply

Your email address will not be published. Required fields are marked *