Programming Previous page   Next Page

Resolving "Out of Memory" Errors

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. This section covers the following topics providing suggestions on how to resolve such errors:

General Suggestions for Reclaiming Memory

When you see the Out of Memory message, use any of the techniques discussed under Using Memory Efficiently to help optimize the available memory. If the Out of Memory message still appears, you can try any of the following:

Compressing Data in Memory

Since MATLAB uses a heap method of memory management, extended MATLAB sessions may cause memory to become fragmented. When memory is fragmented, there may be plenty of free space, but not enough contiguous memory to store a new large variable. If you get the Out of Memory message from MATLAB, the pack function may be able to compress some of your data in memory, thus freeing up larger contiguous blocks.


Previous page  Strategies for Efficient Use of Memory Increasing System Swap Space Next page

© 1994-2005 The MathWorks, Inc.