> From: André Warnier [mailto:a...@ice-sa.com] > Subject: Re: Preventing OutOfMemoryError: Java heap space > > > I'm going to add an explicit request for garbage > > collection, _before_ the memory becomes seriously > > depleted.
To the OP: explicitly calling GC is a complete waste of time. You have to do something to free up memory by shutting down sessions or otherwise terminating activity within the JVM. Your calling GC won't accomplish anything that the JVM automatically calling GC doesn't do. > But would it not be easier to catch the OOM exception and then > return a "sorry, server overloaded" page to the browser ? It's difficult to do that when the OOME may occur in Tomcat code, outside of control of the webapp. > (and maybe then also trigger a GC just for tidiness) Again, a waste of time - the OOME is not presented until after a major GC has been attempted. > Then this thread starts listening for OOM exceptions (I just > imagine that this can be done). I don't know of any means to do that. > (I would mischievously also add a suggestion to buy some more RAM, > as an even cheaper alternative). That's the only reasonable solution, if the OP is unwilling to implement the throttling Peter suggested. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org