Imaging your Bean as being a branch of a tree and all of the stuff inside of
it their own little branches. When you remove your bean from the session,
you just snipped the branch off the tree. Anything within that branch that
is still connected to the trunk of the tree through some other method, will
stay around, but all of the rest will Go Away.

So, simply, as long as nothing references anything within your bean, then it
will all be reclaimed in due time.

Regars,

Will Hartung
([EMAIL PROTECTED])

----- Original Message -----
From: "Michael Nicholson" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
Sent: Tuesday, September 03, 2002 11:29 AM
Subject: Question about beans and memory...


So, let's say I have a bean with a whole bunch of fields/variables/objects
in it.  You know, like some strings, some ResultSets (very short lived),
some ints,  etc.  Ok, so I finish with my bean.  I don't need it anymore.
So, I remove it from the session (where it lives) and null it out (searBean
= null;).  Hopefully it, at least, can now be garbage collected;  what about
all the little objects that used to live inside of it?  Are they now
garbage?  Or do I need to null them each out?  I suppose I could have a
method cleanUp() or something that would simply null out each object within
the bean and call that right before I was done with the bean, but I'm still
curious.  Also, for request scoped beans, presumably they're garbage nearly
immediately (i.e., right after the request is over).  Do I have to null out
they're objects to make them garbage?

Ok... enough babbling for now.

Michael Nicholson,
Carolina Center for Public Service



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to