tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randy Layman <randy.lay...@aswethink.com>
Subject RE: Known Memory clean-up issues?
Date Thu, 29 Nov 2001 20:25:14 GMT

	The best thing you can do is to find out where YOU are leaking
memory.  Tools like OptimizeIt are very useful for this type of issue.  Here
are a few hints that might help you:
	* Sessions stick around for some time after the user leaves.  If you
have large amounts of data in the session, you might want to make your
timeout smaller
	* Servlet instances stay around for very long amounts of time.
Storing anything in static and/or instance variables of the servlet can
consume memory for very long amounts of time
	* Static fields stay around for very long amounts of time, even if
there are no more references to the classes

	Another tip, if you reduce the Heap size of your JVM then you can
get the problem to happen quicker (since there's less memory available to
leak).


>From the JavaDoc on java.lang.OutOfMemoryError:
"Thrown when the Java Virtual Machine cannot allocate an object because it
is out of memory, and no more memory could be made available by the garbage
collector."

	Something is holding onto lots of memory.  If your servlet is
holding memory and a request comes it, its possible that the servlet is
holding enough memory that Tomcat can't get the memory that it needs to
service the request.

	Randy


> -----Original Message-----
> From: Denis Balazuc [mailto:denis.balazuc@trader.com]
> Sent: Thursday, November 29, 2001 3:42 PM
> To: Tomcat Users List
> Subject: Re: Known Memory clean-up issues?
> 
> 
> Hi all
> 
> Where would you recommend to use System.gc() in the context 
> of JSP pages ?
> I guess it would be useless to intercept every single request 
> and hint the
> system for garbage collection on each request ?
> 
> (Now I quote)
> "Also, before an OutOfMemory is thrown, the Garbage collector is
> guarenteed to run, meaning that you really are using all of 
> your memory.  I
> would look at what you are doing in your code - I have 
> servlets that run for
> weeks without eating up any significant portion of memory"
> 
> I do have many times OutOfMemory exceptions thrown, although 
> we're not doing
> *that* much....
> It happens quite randomly so it's very difficult to isolate 
> the problem.
> Moreover, it even happens when fetching HTML pages from 
> Tomcat, without
> using much JSP...
> I'd like to find a place to catch that error to take action 
> (like restarting
> Tomcat) but the only way we have found is to monitor the server and
> automatically restart it when it fails to respond.
> 
> Any guidance to solve the problem would be appreciated ;-)
> 
> Thanks
> Denis Balazuc
> 
> 
> ----- Original Message -----
> From: "Yoav Shapira" <shapira@mpi.com>
> To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
> Sent: Thursday, November 29, 2001 03:07 PM
> Subject: Re: Known Memory clean-up issues?
> 
> 
> > Howdy,
> >
> > > Any harm in forcing garbage collection to run?
> >
> > You cannot force garbage collection to run, only suggest it to the
> > JVM via methods like System.gc().  If you're having difficulty
> > tracking down memory usage, try a profiler like OptimizeIt that has
> > entire memory trees.
> >
> > In addition, you can use parameters like hprof and verbosegc on
> > the java command line to assist you in monitoring garbage 
> collection.
> >
> > Yoav Shapira
> >
> > --
> > To unsubscribe:   
> <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> > For additional commands: 
> <mailto:tomcat-user-help@jakarta.apache.org>
> > Troubles with the list: 
> <mailto:tomcat-user-owner@jakarta.apache.org>
> >
> 
> 
> --
> To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
> Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>
> 

--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message