
05-23-2008, 11:28 AM
|
|
Member
|
|
Join Date: Jan 2008
Posts: 24
Rep Power: 0
|
|
Java Heap Space
I am getting "Java Heap Space" Exception while trying to upload xml data into mysql database......I need help....
How to get rid of this "Java Heap Space"...
I tried to set Catalina_opts to no use.....
I also tried re-installing Java....
nothing worked...help me...
|
|

05-23-2008, 11:56 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 7,513
Rep Power: 11
|
|
|
In simple word it's memory leak of your application. May be after updating your file still open and try to do the same again and again.
|
|

05-23-2008, 02:45 PM
|
 |
Senior Member
|
|
Join Date: Apr 2008
Location: Canada
Posts: 191
Rep Power: 2
|
|
|
You can try to increase the amount of memory Java uses. to do this you have to specify parameters on the command line
-Xms<size> set initial Java heap size
-Xmx<size> set maximum Java heap size
Example: java -Xms64M -Xmx512M ....
This will start the JVM with 64 MB of memory reserved and will allow increase up to 512 MB. Of course you can specify more. If you are reading a big XML file with DOM that will consume lots of memory. You can also try SAX (if you don't already)
I guess you are using Tomcat. In this situation you have to look at Tomcat startup scripts and modify the way Java JVM is started with the parameters I specified.
|
|

05-24-2008, 05:13 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 7,513
Rep Power: 11
|
|
|
Yep, DOM use a lots of memory. SAX not much. If your application is not a larger one, better to try it.
|
|

10-30-2008, 07:28 AM
|
|
Member
|
|
Join Date: May 2008
Posts: 69
Rep Power: 0
|
|
|
Hi DanielStoner,
How to increase my java heap size using the command given by you. is it ok to run the command from command line... or i should set classpath for java. Please guide me to solve this issue. Due to low memory my system start up is very slow and it takes huge time to open any application. Also i face java heap space problem.
Regards,
Prabhu.
|
|

10-30-2008, 08:47 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 7,513
Rep Power: 11
|
|
|
I think he's clearly state that, to test on the command prompt.
|
|

10-30-2008, 09:28 AM
|
|
Member
|
|
Join Date: May 2008
Posts: 69
Rep Power: 0
|
|
|
Hi Eranga,
Great day to you.
I have done as said by DanielStoner, but nothing is happened. If i try that command through command prompt, it is displaying the options command screen. Also i have administrator rights.
Regards,
Prabhu.
|
|

10-30-2008, 10:24 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 7,513
Rep Power: 11
|
|
|
What you mean by options command window. If that command fail error message is prompt. If not, I think anything is not displayed to the screen.
|
|

10-30-2008, 10:36 AM
|
|
Member
|
|
Join Date: May 2008
Posts: 69
Rep Power: 0
|
|
|
Dear Eranga,
When i type the command given by daniel, im getting the list of options for shortcut key commands. If you are not clear. Ok we can stop here. However eranga, if i run the command, i could not see the process done, instead is there any other way to increase the heap size of java, im using netbeans ide, when opening the ide i face this issue.
|
|

10-30-2008, 10:58 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 7,513
Rep Power: 11
|
|
Once someone doesn't clear what you say, doesn't mean that discussion should be stop. 
Since you are working on NetBeans why are you worrying about those things? Use the NetBeans configuration file.
|
|

10-30-2008, 11:10 AM
|
|
Member
|
|
Join Date: May 2008
Posts: 69
Rep Power: 0
|
|
|
Hi Eranga,
Sorry i did not mean that way. I do not know how to let you know the things happening for me thats why i said like that. Im ready to have discussions a lot with my seniors like you.
If i use netbeans, we can configure the java heap size for it. Ok if so, i will work on it and let you know.
Regards,
Prabhu.
|
|

10-30-2008, 11:15 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 7,513
Rep Power: 11
|
|
|
Config file is located at etc folder in the NetBeans installation folder. Option you have to change is netbeans_default_options
|
|

10-30-2008, 11:23 AM
|
|
Member
|
|
Join Date: May 2008
Posts: 69
Rep Power: 0
|
|
|
Hi Eranga,
netbeans_default_options="-J-Xms512m -J-Xmx512m -J-XX:PermSize=32m -J-XX:MaxPermSize=160m -J-Xverify:none -J-Dapple.laf.useScreenMenuBar=true"
I have increased the maximum and min. size to 512, before it was mini. 32m and maxim. 128m, but should i have to increase the permSize also to that extent or let it be as such, or shall i increase the permSize and MaxPermSize to to some extent.
Regards,
Prabhu.
|
|

10-30-2008, 11:45 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 7,513
Rep Power: 11
|
|
|
Increase MaxPermSize only. And also you can decrees Xms as well, but it can cause UI responsive issues if the OutOfMemory reach. In that case you have to increase it again. You can keep PermSize as it is, that amount is fine work out smoothly.
|
|

10-30-2008, 11:55 AM
|
|
Member
|
|
Join Date: May 2008
Posts: 69
Rep Power: 0
|
|
|
Thank you very much Eranga, for guiding me. However while start-up my pc is very slow, so i have formatted my os, and for the next three days everything went fine, but again now it is very slow to boot-up. Can you please let me know the reason for it. What shall i do to rectify this situation.
Regards,
Prabhu.
|
|

10-30-2008, 12:02 PM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 7,513
Rep Power: 11
|
|
|
You mean after all those changes?
What's the total memory you have in your PC.
|
|

10-30-2008, 12:06 PM
|
|
Member
|
|
Join Date: May 2008
Posts: 69
Rep Power: 0
|
|
|
Before making these changes, i was facing this issue. I have a 2GB Ram size. But even now i noted it after shuting down my pc and logging again, it is taking more time to boot-up.....
|
|

10-30-2008, 12:14 PM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 7,513
Rep Power: 11
|
|
|
This type of issue can cause because of the maximum size you have allocated to NetBeans. Logically it cannot happen, since you don't have open NetBeans. But practically it happen because page file keep those records at the system shutdown. Then when you boot up again, located memory for boot-up can be not enough. May be you have lots of application to run at startup.
Seems that your PC have an issue too, I wonder since you have 2GB or memory NetBeans giving such heap size issue.
|
|

10-30-2008, 12:22 PM
|
|
Member
|
|
Join Date: May 2008
Posts: 69
Rep Power: 0
|
|
|
I can understand eranga, is there any solution to get rid of these performance issue. While start up of my pc. But i could not understand why it was working fine when i formated my os and for next three days it was booting up fine and now it gets slow.
|
|

10-30-2008, 12:27 PM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 7,513
Rep Power: 11
|
|
|
Lots of reason is there. But the reason is we cannot talk technical stuff here in our community. Because we are looking around with Java technologies.
|
|
| 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
|
|
|
All times are GMT +2. The time now is 03:12 AM.
|
|