You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jeremy Johnson <je...@archaeopteryx.freeserve.co.uk> on 2000/04/16 14:38:13 UTC

Sessions and GC

Hi all,

Could someone please clarify for me how Tomcat handles releasing threads that
contain live session objects. And what that means for garbage collection?

In other words, if I have a number of servlets that all call session objects,
and that also instantiate a load of external classes, will the external objects
not be garbage collected until the session has timed out, eg. 30 Mins+

So far as I understand, GC can only take place when the thread the object was
created by is released, which can't happen while it contains objects that may
be required again, which must include the sessions (?).

I know this doesn't sound right, but what am I missing? When does Tomcat
make the objects in a thread created by an http request available for GC?

Many thanks all for a very useful mailing list!

Jeremy Johnson,
jeremy@archaeopteryx.freeserve.co.uk

Re: Sessions and GC

Posted by Jeremy Johnson <je...@archaeopteryx.freeserve.co.uk>.
Many thanks for the reply William!

> The Thread that created the object has nothing to do with the
> determining
> when GC occurs because the session now has a reference to the object.
> Sessions
> are managed separately from Threads that respond to requests.
> 
> WBB

Jeremy.

Re: Sessions and GC

Posted by William Brogden <wb...@bga.com>.

Jeremy Johnson wrote:
> 
> Hi all,
> 
> Could someone please clarify for me how Tomcat handles releasing threads that
> contain live session objects. And what that means for garbage collection?
> 
> In other words, if I have a number of servlets that all call session objects,
> and that also instantiate a load of external classes, will the external objects
> not be garbage collected until the session has timed out, eg. 30 Mins+
> 
> So far as I understand, GC can only take place when the thread the object was
> created by is released, which can't happen while it contains objects that may
> be required again, which must include the sessions (?).
> 
> I know this doesn't sound right, but what am I missing? When does Tomcat
> make the objects in a thread created by an http request available for GC?
> 

The Thread that created the object has nothing to do with the
determining
when GC occurs because the session now has a reference to the object.
Sessions
are managed separately from Threads that respond to requests.

WBB