Solution Number: 1243
Title: Out of Memory
Platform: All Platforms
Versions: All versions
Categories: Error Messages, General
Keywords: Java Heap Space

Problem Description

The error "Out of Memory" occurs.


Of the available memory (RAM and virtual memory), one section, the Java heap, is reserved for Java. The rest of the memory will be available for meshing and solving. If you receive the Out of Memory error, try to increase the Java heap.

Open the comsol.ini file located in the subdirectory bin/$arch in the COMSOL installation directory, where $arch corresponds to the platform you are using. Modify the number in the row that starts with -Xmx, its value is the Java heap size. If you have enough RAM, try doubling the size. By default, this value is -Xmx2g, so doubling it will give the line -Xmx4g for a 64-bit platform. Repeat this for all *.ini files in the same directory.

If you do not have write permission to the bin/$arch directory, you can instead try the following:

  • Copy the comsol.ini file to a folder where you have write permission.
  • Open the file and modify it according to the instructions above.
  • When you launch COMSOL, add the option -comsolinifile [path] to the COMSOL command, where [path] is the path to your new comsol.ini file.

See also:

Knowledge Base 1186: Out of memory during assembly

Knowledge Base 1030: Error: "Out of memory"


COMSOL makes every reasonable effort to verify the information you view on this page. Resources and documents are provided for your information only, and COMSOL makes no explicit or implied claims to their validity. COMSOL does not assume any legal liability for the accuracy of the data disclosed. Any trademarks referenced in this document are the property of their respective owners. Consult your product manuals for complete trademark details.