|
|
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.
|
|

06-26-2008, 09:17 AM
|
|
Member
|
|
Join Date: Jun 2008
Posts: 22
|
|
|
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 
|
|

06-26-2008, 09:53 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 3,042
|
|
|
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.
|
|

06-26-2008, 10:28 AM
|
 |
Senior Member
|
|
Join Date: May 2008
Posts: 282
|
|
|
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
|
|

06-26-2008, 11:35 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 3,042
|
|
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.
|
|

06-26-2008, 03:38 PM
|
|
Member
|
|
Join Date: Jun 2008
Posts: 22
|
|
|
@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
|
|

06-26-2008, 05:52 PM
|
 |
Senior Member
|
|
Join Date: May 2008
Posts: 282
|
|
Hey Pal,
U have taken Eranga in a wrong way. His stmt
Start from the simple things. It's much better all the time.
was for
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
|
|

06-26-2008, 05:56 PM
|
 |
Senior Member
|
|
Join Date: May 2008
Posts: 282
|
|
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
|
|

06-27-2008, 05:29 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 3,042
|
|
|
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.
|
|

06-27-2008, 08:15 AM
|
 |
Senior Member
|
|
Join Date: May 2008
Posts: 282
|
|
Thank you Eranga 
And i am sorry mani if i was bit rude...
__________________
To finish sooner, take your own time....
Nivedithaaaa
|
|

06-27-2008, 08:18 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 3,042
|
|
|
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.
|
|

06-27-2008, 09:52 AM
|
|
Member
|
|
Join Date: Jun 2008
Posts: 22
|
|
|
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.
|
|

06-27-2008, 10:04 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 3,042
|
|
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.
|
|

06-27-2008, 12:13 PM
|
|
Member
|
|
Join Date: Jun 2008
Posts: 22
|
|
|
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
|
|

06-27-2008, 12:15 PM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 3,042
|
|
|
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.
|
|

07-24-2008, 09:36 AM
|
|
Member
|
|
Join Date: Jul 2008
Posts: 4
|
|
lesson not only for java related but also how to deal with others.. well, that's good everyone.. 
|
|

07-24-2008, 12:28 PM
|
|
Member
|
|
Join Date: Jul 2008
Posts: 31
|
|
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.
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){
}
}
}
|
|

07-24-2008, 12:45 PM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 3,042
|
|
|
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.
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|