Why do I receive an OutofMemory error: PermGen space when calling MATLAB 7.0.4 (R14SP2) from Java?

1 view (last 30 days)
I receive the following error when I call MATLAB from my Java program:
Java exception occurred:
java.lang.OutOfMemoryError: PermGen space

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 4 Feb 2010
This is expected behavior.
The PermSpace holds objects describing classes and methods of the Permanent Generation. Applications with large code-base can quickly fill up this segment of the heap which will cause java.lang.OutOfMemoryError: PermGen errors
For more information on garbage collection in Java, you may want to look at the item entitled:
Tuning Garbage Collection with the 1.4.2 Java Virtual Machine
<http://java.sun.com/docs/hotspot/gc1.4.2/>
To increase the Permanent generation heap space, create a java.opts file in the $MATLAB/bin/$ARCH
(Where $MATLAB is your root MATLAB directory and $ARCH is your architecture.)
or in the current directory when you start MATLAB, containing the following command:
-XX:MaxPermSize=128M
This will set the maximum permanent generation size of 128M on Sun JVM when starting the virtual machine. Be sure not to set the java heap bigger than the physical memory of the system.
NOTE: MathWorks has not tested MATLAB with any settings other than our default configuration.

More Answers (0)

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Products


Release

R14SP2

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!