Discussion:
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
(too old to reply)
Nasser Abbasi
2008-07-23 05:19:50 UTC
Permalink
2007a, student version on windoz XP SP2.

I use GUIDE, and after sometime of using it, I notice it gets sluggish in
its response to editing and I see the following Java errors on the console:

"Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java
heap space"

I am not sure why it runs out of RAM so fast. as I have 4 GB of physical
RAM.

I did a google on the above and I see that others have seen this.

I wonder if there is any update on this problem that someone from Mathworks
or others can comment on.

Is this still a problem in later Matlab releases?

thanks,
Nasser
Stefan
2008-07-30 08:34:03 UTC
Permalink
Dear Nasser,

I'm dealing with the same problems. And it seems, that noone
really knows something about the java heap memory. I never
got a clear response on this topic.

I found a small workaround to free some heap memory.

heapTotalMemory = java.lang.Runtime.getRuntime.totalMemory;
heapFreeMemory = java.lang.Runtime.getRuntime.freeMemory;
if(heapFreeMemory < (heapTotalMemory*0.01))
java.lang.Runtime.getRuntime.gc;
end

I'm calling the java garbace collector if the free memory
drops below a certain limit.

Maybe this helps.
Keep me up to date if you get any news according to the java
heap memory.

Best regards,
Stefan.
Post by Nasser Abbasi
2007a, student version on windoz XP SP2.
I use GUIDE, and after sometime of using it, I notice it
gets sluggish in
Post by Nasser Abbasi
its response to editing and I see the following Java
"Exception in thread "AWT-EventQueue-0"
java.lang.OutOfMemoryError: Java
Post by Nasser Abbasi
heap space"
I am not sure why it runs out of RAM so fast. as I have 4
GB of physical
Post by Nasser Abbasi
RAM.
I did a google on the above and I see that others have
seen this.
Post by Nasser Abbasi
I wonder if there is any update on this problem that
someone from Mathworks
Post by Nasser Abbasi
or others can comment on.
Is this still a problem in later Matlab releases?
thanks,
Nasser
Juan Luis
2008-10-21 09:57:01 UTC
Permalink
I get the same error.

It is disgusting, because now I get this error when I execute a file that was working perfectly some days ago. Unfortunately, I had to format my HD and now I get this strange error.

I am a unexperienced user. How can I get this fixed? Thanks very much...
Dave Brackett
2008-10-21 13:32:01 UTC
Permalink
Post by Juan Luis
I get the same error.
It is disgusting, because now I get this error when I execute a file that was working perfectly some days ago. Unfortunately, I had to format my HD and now I get this strange error.
I am a unexperienced user. How can I get this fixed? Thanks very much...
have you tried increasing the maximum allowed heap space as explained in the instructions at this page:
http://www.mathworks.com/support/solutions/data/1-18I2C.html

it sorted my problem when I got this error.
Joel
2010-03-25 15:30:19 UTC
Permalink
I have also run into some troubles with to little allocated memory for the java heap. The default max allocatalbe memory for the java heap in Matlab is 128Mb i think. You can change this by adding a file called
java.opts in $MATLABROOT/bin/$ARCH
If you want to change the max heap size to, for example 1024mb insert a line:
-Xmx2048m
in the java.opts file
I don't know how to unallocate java heap memory when used though...
BR
Joel
Post by Nasser Abbasi
2007a, student version on windoz XP SP2.
I use GUIDE, and after sometime of using it, I notice it gets sluggish in
"Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java
heap space"
I am not sure why it runs out of RAM so fast. as I have 4 GB of physical
RAM.
I did a google on the above and I see that others have seen this.
I wonder if there is any update on this problem that someone from Mathworks
or others can comment on.
Is this still a problem in later Matlab releases?
thanks,
Nasser
john
2012-12-03 17:11:11 UTC
Permalink
The suggested solutions worked for me first time on 2011a
http://www.mathworks.co.uk/support/solutions/en/data/1-18I2C/

Many thanks

Loading...