Faq java lang OutOfMemoryError
Issue:
What can I do if I get a java.lang.OutOfMemoryError error?
Possible Solutions:
Matlab or Solo may return a Java error like this:
> lasterror.message = 'Error using svmengine: Error using svmengine: > Java exception occurred: java.lang.OutOfMemoryError: Java heap space > at libsvm.evri.SvmTrain2.load_problem(SvmTrain2.java:222) ...
Matlab and Solo's engine use their own Java virtual machine (JVM) and they both allocate a certain amount of memory (or heap space) to the JVM. This error occurs because the code being executed requires more memory than the JVM has allocated to it. You may avoid this problem by configuring Matlab or Solo to grant more memory to Java.
Matlab and PLS_Toolbox
In Matlab 2009b, and earlier versions, you increase the allocated Java heap space by creating a file named "java.opts" in your
\Program Files\MATLAB\R2009b\bin\win32\
directory (or \win64 if you are using 64-bit Windows) which contains the single line specifying how much memory to allocate to Java:
-Xmx256m
...if you want to set 256 Mb for the Java heap. This takes effect only after Matlab is restarted. Take care to match the upper and lower case characters in that line and have no spaces between any characters.
If the error still occurs, try increasing the memory allocation and repeat. If you have specified a larger amount of memory than is available on your system then Matlab will not restart; reduce the memory setting and continue. Be aware that your system may not be able to supply enough memory for the Java task.
This java.opts approach applies to other operating systems as well, with the path of the java.opts file being
$MATLABROOT/bin/$ARCH
directory. $MATLABROOT
is the MATLAB root directory and $ARCH
is your system architecture. See this Mathworks page for more details of this approach.)
Matlab 2010a and later versions make it easier to specify the Java memory allocation by providing a graphical user interface. This GUI is accessed from Preferences, go to: Home → Preferences → General → Java Heap Memory. (You can also access the Preferences window by typing:
>> preferences
in the Matlab Command Window.)
Solo
For Solo and its various related products, you increase the allocated Java heap space by creating a file named "java.opts" in your
\Program Files\EVRI\Solo\application\bin\win32\
directory (or \win64 if you are using 64-bit version of the application). The java.opts file should contain the single line specifying how much memory to allocate to Java:
-Xmx256m
...if you want to set 256 Mb for the Java heap. This takes effect only after Solo is restarted. Take care to match the upper and lower case characters in that line and have no spaces between any characters.
If the error still occurs, try increasing the memory allocation and repeat. If you have specified a larger amount of memory than is available on your system then Solo will not restart; reduce the memory setting and continue. Be aware that your system may not be able to supply enough memory for the Java task.
Still having problems? Please contact our helpdesk at helpdesk@eigenvector.com