Arduino IDE Java Errors

Just want to hang out with other Makers and chat about stuff? This is the place to do it.
Post Reply
avrdude
Posts: 32
Joined: Mon Sep 30, 2013 3:42 pm

Arduino IDE Java Errors

Post by avrdude » Fri Apr 04, 2014 4:46 pm

Hi ,
I know I brought this up a while ago, but I never found a solution, so here I am again.
I am running the Arduino IDE on my Windows laptop, and after opening a few sketches (doesn't matter if the windows are still open, they could be closed), it starts to lag severely and a whole heap of Java errors come up at the bottom:
"Exception in thread "AWI-EventQueue-0" java.lang.OutOfMemoryError: Java heap space"
And then a whole heap more errors about other stuff.
Since my last post on this, I reinstalled Java and Arduino, with no better results.
I have also researched this and it appears there is only a few people with this issue - and they all use Arduino on Linux.
Because on Linux, there is a simple solution. Java is running out of memory (impossible on my pc though, it has 16GB), so LINUX users simply run Arduino with -xmx2048m where 2048m is the memory you want the program to have.
But of course on Windows you cannot do this.
And more interesting still is why I have this issue and almost no one else has. My pc has 16GB of RAM, which is more than enough, and there is no RAM corruption (I have tested).
I monitored the RAM usage of the Arduino IDE, it gets to about 165MB then crashes.
I am even more surprised because this is a very small amount to allocate to a program. I have had one program using 4GB before, with no issues despite some lag.

Anyone have any suggestions?

Thanks

cef
Freetronics Staff
Freetronics Staff
Posts: 106
Joined: Wed Nov 09, 2011 12:53 am

Re: Arduino IDE Java Errors

Post by cef » Fri Apr 04, 2014 11:01 pm

It's a limitation in Java that it's that small. Doesn't have anything to do with Windows specifically.

You can change it in Windows via the Java control panel. Look at something like this for how: http://www.auditmypc.com/java-memory-xmx512.asp

BTW: The max Java can allocate for 32 bit Windows is about 1280MB (from memory). If you need more RAM than that for Java, use a 64 bit JVM.

avrdude
Posts: 32
Joined: Mon Sep 30, 2013 3:42 pm

Re: Arduino IDE Java Errors

Post by avrdude » Mon Apr 07, 2014 12:31 pm

Ah yes thank you cef! That seems to have done the trick.
I still wonder why it happened to me but not many others...
Thanks for the help

cef
Freetronics Staff
Freetronics Staff
Posts: 106
Joined: Wed Nov 09, 2011 12:53 am

Re: Arduino IDE Java Errors

Post by cef » Tue Apr 08, 2014 12:12 am

Well the way the Arduino IDE is written, I think it uses more memory the more extras you add to it.

So the more boards in boards.txt, the more libraries, etc, the more memory it uses.

avrdude
Posts: 32
Joined: Mon Sep 30, 2013 3:42 pm

Re: Arduino IDE Java Errors

Post by avrdude » Sun Apr 13, 2014 9:01 pm

Actually, on further testing, it appears this did not work! So I then searched a bit more and found that I could try -xms1024m but no that didn't work either!
This is probably something to do with Java just having a complete breakdown a while ago (due to the brilliance of the wonderful Windows 8), removing itself and then saying I had already installed it. However I got it back somehow but this problem still continued. And the actual origin of the problem is unknown: suddenly one day last year I opened the Arduino IDE and there we go Java errors!
Yes I am aware that including many libraries, etc will take up memory, but it doesn't matter what sketches I open (I could open a whole heap of the "Bare Minimum" sketch), after about 10 it crashes.
All I have to say now to Java is: why?

angusgr
Freetronics Staff
Freetronics Staff
Posts: 853
Joined: Tue Apr 09, 2013 11:19 pm
Location: Melbourne, Australia
Contact:

Re: Arduino IDE Java Errors

Post by angusgr » Mon Apr 14, 2014 1:50 am

avrdude, how many additional libraries do you have installed and how many sketches in your sketchbook?

You might find it's something in particular that's causing it to break, rather than just the quantity. Perhaps try taking them out a few at a time and see what it takes for the errors to go away? You might be able to narrow it down.

Good luck.

- Angus

Post Reply