Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-26-2008, 09:17 AM
Member
 
Join Date: Jun 2008
Posts: 22
itmani2020 is on a distinguished road
Wanted help on "java.lang.OutOfMemoryError: Java heap space"
Hi,
When i m trying to navigate through in my application i m getting this exception"java.lang.OutOfMemoryError: Java heap space+Java"..
When i did some analysis on this i got its something i want to pass the size as argument.can anyone help on it..............

Thanks in Advance,
Mani
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 06-26-2008, 09:53 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 3,042
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
What type of application you tested. Is it given an error on a simple application too, like print 'Hello World'
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
(Close on September 4, 2008)

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 06-26-2008, 10:28 AM
Niveditha's Avatar
Senior Member
 
Join Date: May 2008
Posts: 282
Niveditha is on a distinguished road
Send a message via Skype™ to Niveditha
I think u have created so many objects that jvm has no memory to store anything else.

if ur application is really huge then, Why dont u do a garbage collection?

But b4 all that check what Eranga suggested u it may b problem with JVM too.
__________________
To finish sooner, take your own time....
Nivedithaaaa
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 06-26-2008, 11:35 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 3,042
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Start from the simple things. It's much better all the time.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
(Close on September 4, 2008)

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 06-26-2008, 03:38 PM
Member
 
Join Date: Jun 2008
Posts: 22
itmani2020 is on a distinguished road
@Eranga
its not a simple application it consist of heavy load at the database.............can any one help me in increase the heap size in eclipse or in JRE.....................

Thanks ,
Mani
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 06-26-2008, 05:52 PM
Niveditha's Avatar
Senior Member
 
Join Date: May 2008
Posts: 282
Niveditha is on a distinguished road
Send a message via Skype™ to Niveditha
Hey Pal,
U have taken Eranga in a wrong way. His stmt
Quote:
Start from the simple things. It's much better all the time.
was for
Quote:
Is it given an error on a simple application too, like print 'Hello World'
If ur application is huge then do a garbage collection or
check this link to increase heap size it gives u 2 ways of doing it.
Increase heap size in Java to prevent java.lang.OutOfMemoryError
__________________
To finish sooner, take your own time....
Nivedithaaaa
Bookmark Post in Technorati
Reply With Quote
  #7 (permalink)  
Old 06-26-2008, 05:56 PM
Niveditha's Avatar
Senior Member
 
Join Date: May 2008
Posts: 282
Niveditha is on a distinguished road
Send a message via Skype™ to Niveditha
And remeber one thing no one here is waiting here with readymade answers to help u out, they are just sharing their knowledge with u.

Before writing anything read all the posts and then reply ok...
Being rude or short-tempered is not going to help u out in IT industry.
__________________
To finish sooner, take your own time....
Nivedithaaaa
Bookmark Post in Technorati
Reply With Quote
  #8 (permalink)  
Old 06-27-2008, 05:29 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 3,042
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Well said Niveditha, as you said no one here to write code here for others. I don't think any one wants to do it. Sometimes we give code, because we can see he/she make an attempt and failed to get the correct way.

And also, don't be hurry. Please read the post carefully before commenting any.

Keep in mind, because of such behaviors can be in 'not to replay' list for many members. It's not good my friends.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
(Close on September 4, 2008)

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #9 (permalink)  
Old 06-27-2008, 08:15 AM
Niveditha's Avatar
Senior Member
 
Join Date: May 2008
Posts: 282
Niveditha is on a distinguished road
Send a message via Skype™ to Niveditha
Thank you Eranga
And i am sorry mani if i was bit rude...
__________________
To finish sooner, take your own time....
Nivedithaaaa
Bookmark Post in Technorati
Reply With Quote
  #10 (permalink)  
Old 06-27-2008, 08:18 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 3,042
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
No not at all. All these well let because as you said a forum is a place where we can share our knowledge. You tried point out that to all, that's it.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
(Close on September 4, 2008)

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #11 (permalink)  
Old 06-27-2008, 09:52 AM
Member
 
Join Date: Jun 2008
Posts: 22
itmani2020 is on a distinguished road
Hey niveditha ,

i understood what eranga replied............
but for simple application its not occuring......this will happen only when i m trying to load heavy the data..............

sorry if i hurted someone.
My intension here is not to hurt members.just to help and get rid of that bug.............anyway sorry once more.
Bookmark Post in Technorati
Reply With Quote
  #12 (permalink)  
Old 06-27-2008, 10:04 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 3,042
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
No one hurt on anyone itmani.

We always advice in good ways, that's it. So don't worry.

Before giving any comments best thing is start from the simple step. That's why ask that simple application and so on. As you said IDE not hurt you on a simple application. That means your real application has a problem.

Since it's a DB related application, lots of reasons can be cause. Mainly the way you handle connects, data sets and so on.

Why we advice such things, just increase the heap size not always best. When you increase the heap size it cause to your whole system(PC).

Check on IDE options, there may be some options to change those values. There should minimum as well as maximum values. I can't say exactly how it done, because I never work on Eclipse.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
(Close on September 4, 2008)

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #13 (permalink)  
Old 06-27-2008, 12:13 PM
Member
 
Join Date: Jun 2008
Posts: 22
itmani2020 is on a distinguished road
ya eranga....
after some depth search at google....they mentioned if we run the eclipsce from cmd prompt we r able to give attribute.......i m trying to debugg that issue.....i think i m in right path............

Cheers,
Mani
Bookmark Post in Technorati
Reply With Quote
  #14 (permalink)  
Old 06-27-2008, 12:15 PM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 3,042
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Yep, it's better. Try and see. If I have time, refer some on Google and let you know.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
(Close on September 4, 2008)

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #15 (permalink)  
Old 07-24-2008, 09:36 AM
Member
 
Join Date: Jul 2008
Posts: 4
sheena06 is on a distinguished road
lesson not only for java related but also how to deal with others.. well, that's good everyone..
Bookmark Post in Technorati
Reply With Quote
  #16 (permalink)  
Old 07-24-2008, 12:28 PM
Member
 
Join Date: Jul 2008
Posts: 31
skaspersen is on a distinguished road
Are you using JDBC?
If this is the case the problem is probably that you are not closing statements and resultsets when you are done with them.

The mysql driver uses native code and allocates memory that is not in control of the garbage collector. This memory will only be freed when you call Statement.close(),PreparedStatement.close(), and ResultSet.close().

Good programming example for JDBC.

Code:
PreparedStatement ps = null; ResultSet rs = null; try{ ps = connection.prepareStatement("Select *from table where table.somefield=?"); ps.setString(1,"StringValue"); rs = ps.executeQuery(); while(rs.next()){ //MAKE USE OF RESULTS } }catch(SqlException e){ } finally{ if(rs!=null){ try{ rs.close(); } catch(SqlException e1){ } } if(ps!=null){ try{ ps.close(); } catch(SqlException e1){ } } }
Bookmark Post in Technorati
Reply With Quote
  #17 (permalink)  
Old 07-24-2008, 12:45 PM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 3,042
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Yes the best thing is check all conditions that you have safely exit. It can be caused to have more problems.

And also if you want, you can call the garbage collector by your self.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
(Close on September 4, 2008)

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space Eku NetBeans 14 06-12-2008 09:36 AM
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException paul New To Java 1 08-07-2007 06:02 AM
Error: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException romina New To Java 1 07-25-2007 11:55 PM
java.lang.OutOfMemoryError: Java heap space paul Advanced Java 1 07-25-2007 09:07 PM
ArrayList: Exception in thread "main" java.lang.NullPointerException susan New To Java 1 07-16-2007 07:32 AM


All times are GMT +3. The time now is 09:52 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org