Howdy, Very few things are guaranteed regarding garbage collection when you consider your system as a whole. The container can almost always cache things like JSPs, servlets, and sessions until it feels like releasing them. Some of these parameters you can control via configuration, e.g. session expiration.
System.gc() is a suggestion. It doesn't guarantee garbage collection will run. In fact, JDK 1.4 and later can be told to ignore calls to System.gc via a runtime option, so your server admin may set this option, at which point you could rely on System.gc() even as a suggestion to the VM. Have your tried adding -verbose:gc to your runtime options? That will let you know when garbage collection is running and how much memory it collected at each run. Have your tried using another garbage collector, e.g. the incremental (-Xincgc) or concurrent mark-sweep (-XX:+UseConcMarkSweepGC (available beginning with J2SE 1.4.1) ? Yoav Shapira Millennium ChemInformatics >-----Original Message----- >From: Michael Nicholson [mailto:[EMAIL PROTECTED]] >Sent: Thursday, August 29, 2002 9:08 AM >To: Tomcat Users List >Subject: OT: Garbage Collection in Java: Am I an idiot? > >The answer to the (completely rhetorical) question is probably yest, but >I've got another question, too. > >So, I have this moderately large application with jsps, servlets, and an >Oracle DB. It does its thing ok, but it never releases memory. There are >certainly session variables (probably way too many, but that's (hopefully) >a question for another day), but even after the session expires, I'm still >using the same amount of memory. I even included a direct call to >System.gc() on my first page, hoping to collect the memory from the three >day old sessions, but no luck. > >So, my thoughts/questions: Some connections are still opened (this is >what's running on my development server right now: however, the actual >development is done in Sun ONE on my desktop, so I'm going through and >making sure all of those are closed there... but I'm also trying to debug >this memory issue), so maybe these open connections force some of the >session scoped beans to persist? Forever? Or am I just missing something >completely about garbage collection? > >So, in short, if I have a session scoped bean that has in it something like >a connection or a recordset (which is most likely not a good idea... I now >know that), even after the session times out, would that bean continue to >exist? And eat up my memory? > >Sorry for the rambling. > >Michael Nicholson, >Carolina Center for Public Service
This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you.
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>