tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Saurabh Arora" <Sar...@novell.com>
Subject RE: Memory Usage and Garbage Collection
Date Fri, 03 Jan 2003 09:33:17 GMT
Just wanted to know, does the current implementation of tomcat 4.1.18
also has the same problem of keeping the jsp's
 in memory. or it was only present in 4.0.4


saurabh 

>>> andpro77@gmx.net 01/03/03 02:26PM >>>
Hi Craig,

please see intermixed.

On 2 Jan 2003 at 18:18, Craig R. McClanahan wrote:

> 
> Instances can be garbage collected IF AND ONLY IF there are no
> live references to that object in a static/instance/local
> variable of some other object that is also in memory.  Only
> instances that are no longer referenced from other object
> instances can be recycled.

Please consider the following service() or doGet() or so of a 
servlet:

public void service(ServletRequest request, ServletResponse 
response)
   throws IOException
{
  OtherObject otherObject = new OtherObject();
  otherObject.doThisAndThat(request, response);
}

Do I have to place the following
otherObject = null;
before the end of service(). Doesn't otherObject be gc-ed 
otherwise? I've never done this.

What about the object instances, which 
otherObject.doThisAndThat() creates? So far I've thought there 
are no live references if otherObject gets gc-ed.

> 
> In the case at hand, Tomcat (obviously) has references to all the
> servlets that it has loaded.  Therefore, those servlet instances
> cannot be garbage collected.  Furthermore, any object that is
> referenced by static or instance variables of your servlet class
> can *also* not be garbage collected, because live references
> still exist.  Same thing for session attributes.

OK, this is obvious.

Andreas

deleted the latter parts...




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


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


Mime
View raw message