Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.lang.OutOfMemoryError

 
George Ren
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,everyone!


Using JBuilder X, I worte a piece of code, which draw a red point on the screen when user confirmed. Before the point is drawed, the user must click OK on a dialog, then an other dialog created, the user must give some information such as Username,ID and User's mobile phone No, etc. in a dialog. Nothing is wrong in the compling phase, But when I run the project, JBuilder reported me a java.lang.OutOfMemoryError. I was confused. Here is the debug message:

-----------------------
D:\JBuilderX\jdk1.4\bin\javaw -classpath
"C:\Projects\Electric_Control\new\Electric_Control\classes;D:\JBuilderX\jdk1.4\lib\comm.jar;
D:\JBuilderX\jdk1.4\demo\jfc\Java2D\Java2Demo.jar;
D:\JBuilderX\jdk1.4\demo\plugin\jfc\Java2D\Java2Demo.jar;
D:\JBuilderX\jdk1.4\jre\javaws\javaws.jar;
D:\JBuilderX\jdk1.4\jre\lib\charsets.jar;
D:\JBuilderX\jdk1.4\jre\lib\ext\dnsns.jar;
D:\JBuilderX\jdk1.4\jre\lib\ext\ldapsec.jar;
D:\JBuilderX\jdk1.4\jre\lib\ext\localedata.jar;
D:\JBuilderX\jdk1.4\jre\lib\ext\sunjce_provider.jar;
D:\JBuilderX\jdk1.4\jre\lib\im\in dicim.jar;
D:\JBuilderX\jdk1.4\jre\lib\im\thaiim.jar;
D:\JBuilderX\jdk1.4\jre\lib\jce.jar;
D:\JBuilderX\jdk1.4\jre\lib\jsse.jar;
D:\JBuilderX\jdk1.4\jre\lib\plugin.jar;
D:\JBuilderX\jdk1.4\jre\lib\rt.jar;
D:\JBuilderX\jdk1.4\jre\lib\sunrsasign.jar;
D:\JBuilderX\jdk1.4\lib\dt.jar;
D:\JBuilderX\jdk1.4\lib\htmlconverter.jar;
D:\JBuilderX\jdk1.4\lib\tools.jar" gui.ElecCtrl
java.lang.OutOfMemoryError
-----------------------

Below will be my code:

MainGui:



The popup dialog code which the user click OK :


The other dialog that the user give some information:



The code is quite long Thank you for reading!

[ Jess edited the classpath so that it doesn't stretch the screen all the way across, also removed the "quote" block around the classpath because UBB has issues when you edit a post with "quote" and "code" blocks in the same post ]
[ August 02, 2004: Message edited by: Jessica Sant ]
 
Jessica Sant
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I haven't read through your post, but a quick fix may be to simply increase the size of the heap and avoid the OutOfMemoryError.

when you start the program, add something like this:
java -Xmx400m com.package.MyClass

That command allocates 400MB to the Java Heap -- and hopefully allows your program to run.

If something like that doesn't work, you'll need to debug your program and find out where the memory leak is. JProbe is a great program that you can use to easily identify those pesky memory leaks.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic