Programming and Data Types    

"Out of Memory" Errors

Typically, MATLAB generates an Out of Memory message whenever it requests a segment of memory from the operating system that is larger than what is currently available. When you see this message, use any of the techniques discussed earlier in this section to help optimize the available memory.

If the Out of Memory message still appears, you can try any of the following:

Increasing the System Swap Space

How you set the swap space for your computer depends on what operating system you are running on.

UNIX.   Information about swap space can be procured by typing pstat -s at the UNIX command prompt. For detailed information on changing swap space, ask your system administrator.

Linux.   Swap space can be changed by using the mkswap and swapon commands. For more information on the above commands, type man command_name at the Linux prompt.

Windows 98, Windows NT, and Windows ME.   Follow the steps shown here:

  1. Right-click on the My Computer icon, and select Properties.
  2. Select the Performance tab and click the Change button to change the amount of virtual memory.

Windows 2000.   Follow the steps shown here:

  1. Right-click on the My Computer icon, and select Properties.
  2. Select the Advanced tab and choose Performance Options.
  3. Click on the Change button to change the amount of virtual memory.

Running MATLAB Without the Java Virtual Machine

You are more likely to encounter Out of Memory errors when using MATLAB Version 6.0 or greater due to the use of the Java Virtual Machine (JVM) within MATLAB. The JVM and MATLAB use the same virtual address space, leaving less memory available for your MATLAB applications to use.

MATLAB uses the JVM to implement its GUI-based development environment. You are encouraged to use this environment for your application development work. However, if you get Out of Memory errors while running memory intensive applications, and you are running MATLAB on a UNIX platform, you may want to run these without the JVM.

On UNIX systems, it is possible to run MATLAB without the JVM by starting MATLAB with a -nojvm switch. Type the following at the UNIX prompt:

When you use this option, you cannot use the desktop or any of the MATLAB tools that require Java.


  Ways to Conserve Memory Platform-Specific Memory Topics