You don't need to set null explicitly if you are not code that init method
your servlet.The container will create and destroy the for every invocation
of your servlet's or JSp's service method.

----- Original Message -----
From: "Vibha Jindal" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 31, 2002 11:46 AM
Subject: Re: Garbage Collection


> Hi,
>
> I was intereested in knowing the effect in Servlets and JSPs.
> I believe that the Servlets are destroyed as soon as they throw the JSP.
>
> And once the JSP displays the HTML, I guess it loses scope. So, all
objects
> initialised in these JSPs and servlets should not require me to set the
> references to null.
> Or do I need to ?
>
> Regards,
> Vibha
>
> ----- Original Message -----
> From: Vikramjit Singh <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, January 31, 2002 9:32 AM
> Subject: Re: Garbage Collection
>
>
> > hi vibha,
> >
> > the objects will be eligible for garbagecollection if it is unreachable
> i.e.
> > no object references to that particular object. It is always better to
put
> > your object references to null. You cannot be sure that setting the
object
> > references to null, they will be garbage collected but they will become
a
> > candidate for garbage collection.
> > I always do like this for resultsets, statements and connections in the
> > finally block. For more information on garbage collection you can read
> some
> > core java books.
> >
> > finally
> > {
> >         if (rs != null)
> >         {
> >                 rs.close();
> >                 rs = null;
> >         }
> > }
> >
> > Vikramjit Singh,
> > Systems Engineer,
> > GTL Ltd.
> > Ph. 7612929-3140
> >
> >
> > -----Original Message-----
> > From: Vibha Jindal [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, January 30, 2002 7:59 PM
> > To: [EMAIL PROTECTED]
> > Subject: Garbage Collection
> >
> >
> > Hi,
> >
> > I am creating instances of dataclasses in my Servlets and JSPs.
> > I am not explicitly setting them to null after use.
> > Could this be a problem?
> > I mean, would these objects not be eligible for garbage collection or
> would
> > they be eligible?
> >
> > Regards,
> > Vibha
> >
> >
>
===========================================================================
> > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> > JSP-INTEREST".
> > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> > DIGEST".
> > Some relevant FAQs on JSP/Servlets can be found at:
> >
> >  http://archives.java.sun.com/jsp-interest.html
> >  http://java.sun.com/products/jsp/faq.html
> >  http://www.esperanto.org.nz/jsp/jspfaq.jsp
> >  http://www.jguru.com/faq/index.jsp
> >  http://www.jspinsider.com
> >
> >
>
===========================================================================
> > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> DIGEST".
> > Some relevant FAQs on JSP/Servlets can be found at:
> >
> >  http://archives.java.sun.com/jsp-interest.html
> >  http://java.sun.com/products/jsp/faq.html
> >  http://www.esperanto.org.nz/jsp/jspfaq.jsp
> >  http://www.jguru.com/faq/index.jsp
> >  http://www.jspinsider.com
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://archives.java.sun.com/jsp-interest.html
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.jsp
>  http://www.jguru.com/faq/index.jsp
>  http://www.jspinsider.com
>

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to