View Full Version : clearing JVM memory
ynotlim
08-10-2007, 12:59 AM
Hello,
How do I clear the JVM memory in Java? Is the only way by restarting tomcat? I have a memory heap problem and need to clear the JVM memory after the application is run each time.
Thank you,
Tony
Lallo
08-10-2007, 09:59 AM
Hello,
How do I clear the JVM memory in Java? Is the only way by restarting tomcat? I have a memory heap problem and need to clear the JVM memory after the application is run each time.
Thank you,
Tony
The JVM has Garbage Collector and clears the memory itself. The problem that you have probably is because of your code. Review the code and see if you have any bugs.
cash1981
08-10-2007, 02:38 PM
You can also try System.gc(); which runs the garbage collection. But it is no guarantee that it will run it.
ynotlim
08-10-2007, 06:39 PM
Thanks for the tip, but the JVM memory still isn't clearing.
here's what i'm seeing
-------------
JVM
Free memory: 36.85 MB Total memory: 63.81 MB Max memory: 63.81 MB
-------------
The total memory starts at 10 MB and my application uses it up to 63 then freezes. How can i clear the total memory after the application runs each time?
Thanks
Tony
Lallo
08-10-2007, 07:09 PM
Is the code big?
what kind of code it is?
Why using so much memory?
my guess - using if-else too much....or endless recursive function/for loop........it could be anything and I want to see it if possible!
Can you send the code so I can see this miracle?
cheers :thumbsup:
ynotlim
08-10-2007, 08:08 PM
Hey Lallo,
Thanks for your concerns. The code I'm using is from:
http://sourceforge.net/projects/jspsurveylib/
I found the solution the problem on the forum. I used the mysql driver 3.0.11 instead of 3.1.12
Thanks again,
Tony
Lallo
08-12-2007, 12:13 PM
great! So keep on!
Regards!
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.