OutOfMemory Error

Reply

Join Date: Sep 2005
Posts: 17
Reputation: perlsu is an unknown quantity at this point 
Solved Threads: 0
perlsu perlsu is offline Offline
Newbie Poster

OutOfMemory Error

 
0
  #1
Sep 14th, 2005
Hi

I got runtime error as "Exception in thread "main" java.lang.OutOfMemoryError: Java heap space ". How can I solve this problem? Can anyone explain me why this problem occurs? Thanks in advance.
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 2,108
Reputation: server_crash is on a distinguished road 
Solved Threads: 18
server_crash server_crash is offline Offline
Postaholic

Re: OutOfMemory Error

 
0
  #2
Sep 14th, 2005
I would guess you're using recursion...maybe?
Recursion can cause this, and so can many other things. Explain what your program is doing, please.
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,145
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 212
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: OutOfMemory Error

 
0
  #3
Sep 14th, 2005
Recursion causes StackOverflow, not often OutOfMemory

You're probably trying to read in some very large file or otherwise reserving a lot of memory.
Figure out where you are doing that and try to find a way around it.
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 216
Reputation: hooknc is an unknown quantity at this point 
Solved Threads: 8
hooknc hooknc is offline Offline
Posting Whiz in Training

Re: OutOfMemory Error

 
0
  #4
Sep 14th, 2005
Just adding to what the two above stated...

Look to see if you're creating lots of new objects. Memory Exceptions ocure when your java application uses all of its allowed memory. I believe the default setting is 64megs. My guess is that inside a loop (if, while, or a recursive loop) there are new objects being created. While this isn't bad, it could be the source of the problem.

Regards,

Nate
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 609
Reputation: freesoft_2000 is an unknown quantity at this point 
Solved Threads: 7
freesoft_2000 freesoft_2000 is offline Offline
Practically a Master Poster

Re: OutOfMemory Error

 
0
  #5
Sep 20th, 2005
Hi everyone,

I thnk you will have to use -Xms and -Xmx as such

  1. java -Xms<initial heap size> -Xmx<maximum heap size>

You best bet is make your own mini application launcher to get around this problem.

Richard West
Microsoft uses "One World, One Web, One Program" as a slogan.
Doesn’t that sound like "Ein Volk, Ein Reich, Ein Führer" to you, too?
— Eric S. Raymond

Tell me what type of software do you like and what would you pay for it

http://www.daniweb.com/techtalkforums/thread19660.html
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,145
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 212
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: OutOfMemory Error

 
0
  #6
Sep 20th, 2005
Unless there's a definite limit to the amount of memory the application will claim (so no errors or unforeseen conditions causing infinite loops for example) that will only delay the inevitable
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Java Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC