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

Reply via email to