You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "daad@libero.it" <da...@libero.it> on 2007/04/30 12:37:27 UTC

Runtime.getRuntime().****Memory()

As i wrote in my previous messages i'm experiencing OutOfMemory heap problems.
I added a Runtime.getRuntime().totalMemory() and Runtime.getRuntime().freeMemory() at the end of the main client thread that is created when a client connects to the webapp.
I noticed that when i deply the webapp i got those values:

Total Memory: 43425792. Free Memory left: 17827832

After about an hour the values drop to:

Total Memory: 43425792. Free Memory left: 6898584

and keep getting lower.
After 1 hour and half i got that:

Total Memory: 43425792. Free Memory left: 439248

so i thought that this would go to OutOfMemory soon, but after some mins i got:

Total Memory: 58986496. Free Memory left: 25538936

so i went to catalina.out logs and looked what happen:

[Unloading class sun.reflect.GeneratedMethodAccessor44]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor10]
[Unloading class sun.reflect.GeneratedMethodAccessor48]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor14]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor8]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor11]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor13]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor9]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor15]
[Unloading class org.apache.jsp.admin_jsp]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor12]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor7]
[Loaded com.mysql.jdbc.Messages from file:/usr/local/jakarta/jakarta-tomcat-5.5.9/common/lib/mysql-connector-java-5.0.5-bin.jar]
[Loaded sun.reflect.GeneratedSerializationConstructorAccessor16 from __JVM_DefineClass__]
[Loaded sun.reflect.GeneratedSerializationConstructorAccessor17 from __JVM_DefineClass__]

Why total memory increased? it adjusted the heap memory to not go out of memory? from 43mb to 58mb there is 15mb of difference, why the free space raised to 25mb then? the garabge collection wasn't efficent?

I started the server with "java -server -Xms512m -Xmx1024m" so the heap will be resized untill it reaches 1024mb?

I'm using db connection pooling, is there a chance that it's getting a lot of resources? i followed the tutorials to create and close db connections for pooling reuse: if i used them wrong, shouldn't i get another error message?

It's some weeks i'm trying to figure out what's the problem of those OutOfMemory heap errors, any help is appreciated.



------------------------------------------------------
Leggi GRATIS le tue mail con il telefonino i-modeĀ™ di Wind
http://i-mode.wind.it/



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Runtime.getRuntime().****Memory()

Posted by Martin Gainty <mg...@hotmail.com>.
You will need to enable GC Stats for your JVM
either on command line or
set in JVM_OPTS env variable or
handcode in %JAVA_HOME%/jre/lib/i386/jvm.cfg
e.g.
java -verbose:gc -XX:+PrintGCTimeStamps -XX:+PrintGCDetails

and then use a GCStatAnalyzer to look at ObjectAllocation and 
ObjectPromotion/younggenCollectionTime
e.g.
PrintGCStats -v ncpu=<n> [-v interval=<seconds>] [-v verbose=1] <gc_log_file 
 >

http://java.sun.com/developer/technicalArticles/Programming/turbo/index.html

Does this help?
Martin--
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.

----- Original Message ----- 
From: <da...@libero.it>
To: "users" <us...@tomcat.apache.org>
Sent: Monday, April 30, 2007 6:37 AM
Subject: Runtime.getRuntime().****Memory()


As i wrote in my previous messages i'm experiencing OutOfMemory heap 
problems.
I added a Runtime.getRuntime().totalMemory() and 
Runtime.getRuntime().freeMemory() at the end of the main client thread that 
is created when a client connects to the webapp.
I noticed that when i deply the webapp i got those values:

Total Memory: 43425792. Free Memory left: 17827832

After about an hour the values drop to:

Total Memory: 43425792. Free Memory left: 6898584

and keep getting lower.
After 1 hour and half i got that:

Total Memory: 43425792. Free Memory left: 439248

so i thought that this would go to OutOfMemory soon, but after some mins i 
got:

Total Memory: 58986496. Free Memory left: 25538936

so i went to catalina.out logs and looked what happen:

[Unloading class sun.reflect.GeneratedMethodAccessor44]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor10]
[Unloading class sun.reflect.GeneratedMethodAccessor48]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor14]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor8]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor11]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor13]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor9]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor15]
[Unloading class org.apache.jsp.admin_jsp]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor12]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor7]
[Loaded com.mysql.jdbc.Messages from 
file:/usr/local/jakarta/jakarta-tomcat-5.5.9/common/lib/mysql-connector-java-5.0.5-bin.jar]
[Loaded sun.reflect.GeneratedSerializationConstructorAccessor16 from 
__JVM_DefineClass__]
[Loaded sun.reflect.GeneratedSerializationConstructorAccessor17 from 
__JVM_DefineClass__]

Why total memory increased? it adjusted the heap memory to not go out of 
memory? from 43mb to 58mb there is 15mb of difference, why the free space 
raised to 25mb then? the garabge collection wasn't efficent?

I started the server with "java -server -Xms512m -Xmx1024m" so the heap will 
be resized untill it reaches 1024mb?

I'm using db connection pooling, is there a chance that it's getting a lot 
of resources? i followed the tutorials to create and close db connections 
for pooling reuse: if i used them wrong, shouldn't i get another error 
message?

It's some weeks i'm trying to figure out what's the problem of those 
OutOfMemory heap errors, any help is appreciated.



------------------------------------------------------
Leggi GRATIS le tue mail con il telefonino i-modeT di Wind
http://i-mode.wind.it/



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org