Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Fatal Error: Java Run Time

Subject: Fatal Error: Java Run Time

From: cabrego

Date: 22 Oct, 2010 14:55:05

Message: 1 of 6

I am running a M code that imports files and sorts and plots data automatically. The code is to generate 128 plots.

At around plot 90 I begin getting errors:

Exception in thread "AWT -Event Queue-0" java.lang.OutOfMemoryError: java heap space

It also looks like an error log file was created but I have no clue how to read it. I had plenty of memeory available according to the end of the log (1.6 GB free)

Any ideas what I should look into?

Subject: Fatal Error: Java Run Time

From: Steven_Lord

Date: 22 Oct, 2010 17:13:02

Message: 2 of 6



"cabrego " <cpabrego@gmail.com> wrote in message
news:i9s8k9$ir7$1@fred.mathworks.com...
> I am running a M code that imports files and sorts and plots data
> automatically. The code is to generate 128 plots.

Do you really need all 128 figure windows open at the same time? If not, I
would open one figure at the beginning of your code, display your graphics
on it, save it to a file (using PRINT, SAVEAS, etc.) and then clear the
contents of that figure so you can reuse it for your next plot.

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: Fatal Error: Java Run Time

From: cabrego

Date: 22 Oct, 2010 17:33:04

Message: 3 of 6

No I don't need them opened simultaneusly-I am still testing the code so I wanted to see that they were all being generated as expected.

Am I running into a limitation?

Thanks,

Subject: Fatal Error: Java Run Time

From: Steven_Lord

Date: 22 Oct, 2010 20:31:56

Message: 4 of 6



"cabrego " <cpabrego@gmail.com> wrote in message
news:i9shsg$f1$1@fred.mathworks.com...
> No I don't need them opened simultaneusly-I am still testing the code so I
> wanted to see that they were all being generated as expected.
> Am I running into a limitation?

Every figure you open requires some resources -- since your computer has
finite resources, eventually you're going to run out. In this case, the
resource you ran out of was Java heap space, and you ran out of that after
90 figure windows.

You probably noticed your machine starting to slow down as the number of
figure windows increased, right? That's also caused by the increased
resource usage.

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: Fatal Error: Java Run Time

From: cabrego

Date: 22 Oct, 2010 21:01:06

Message: 5 of 6


>
> Every figure you open requires some resources -- since your computer has
> finite resources, eventually you're going to run out. In this case, the
> resource you ran out of was Java heap space, and you ran out of that after
> 90 figure windows.
>
> You probably noticed your machine starting to slow down as the number of
> figure windows increased, right? That's also caused by the increased
> resource usage.
>
> --
> Steve Lord
> slord@mathworks.com
> comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ

Actually my system is pretty stout for a 32 bit system. Dual 6 core processors and 4 gb of ram.

Had plent of RAM and PLENTY of processor-I expected the ram to be at 100% or something but all was well.


> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com

Subject: Fatal Error: Java Run Time

From: Yair Altman

Date: 23 Oct, 2010 16:12:05

Message: 6 of 6

"cabrego " <cpabrego@gmail.com> wrote in message <i9su2i$bp0$1@fred.mathworks.com>...
>
> >
> > Every figure you open requires some resources -- since your computer has
> > finite resources, eventually you're going to run out. In this case, the
> > resource you ran out of was Java heap space, and you ran out of that after
> > 90 figure windows.
> >
> > You probably noticed your machine starting to slow down as the number of
> > figure windows increased, right? That's also caused by the increased
> > resource usage.
> >
> > --
> > Steve Lord
> > slord@mathworks.com
> > comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
>
> Actually my system is pretty stout for a 32 bit system. Dual 6 core processors and 4 gb of ram.
>
> Had plent of RAM and PLENTY of processor-I expected the ram to be at 100% or something but all was well.
>
>
> > To contact Technical Support use the Contact Us link on
> > http://www.mathworks.com


Unfortunately, Matlab uses a Java engine for much of its graphics generation, and this Java engine uses a default meager allocation of only 128MB (or 64MB, depending on your Matlab version) of heap memory space. You can increase this default value as explained here: http://www.mathworks.com/support/solutions/en/data/1-18I2C/

Yair Altman
http://UndocumentedMatlab.com

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us