tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <christopher.d.schu...@comcast.net>
Subject Re: Garbage Collection issues
Date Tue, 02 Dec 2003 03:14:51 GMT
Neal,

> When I said that "surely it can't be a memory leak in my app" I was
> operating under the assumption that the JRE runs garbage collection
> periodically anyway....is this not true?

The GC is pretty much free to run whenever it wants. Often, it will not
run until you get very close to running out of memory.

Actually, most modern GCs run all the time, but do very little work.
They free-up short-leved objects and only re-claim a very small amount
of memory. After some longer-lived (and dead) objects accumulate on the
heap, then the GC does a "full GC" and the heap goes *way* down (this is
likely to be what you see when you "force" a GC).

> If I was waisting resources and not releasing them in a way that the
> GC could take them back when it runs automatically then why would it
> take them back when I call garbage collection explicitly?

Did this "forced GC helps" situation happen in a dev environment or in 
production?

> To me,
> this suggested more of a systemic issue.  It was suggested by someone
> last night that I may want to look at some config lines to make sure
> GC is active and this seemed in line with my assumption.  Is there
> something else here that I may be missing however?  Can you see a
> possible explanation as to why my app's wasted resources would not
> get cleaned up until I explicitly ran GC?

As I said, sometimes the GC takes it's sweet time. What, if any, memory 
settings do you use, and do you use any GC specific settings?

For debugging purposes, it's often helpful to enable "verbose GC" -- 
check your VM's command-line options for how to enable that.

Many production deployments set both the min and max heap sizes to the 
same power-of-two setting (i.e. 128M, 256M, 1024M, etc.)

-chris



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message