Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@jakarta.apache.org Received: (qmail 79454 invoked by uid 500); 14 Jun 2001 20:24:05 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk Reply-To: tomcat-user@jakarta.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 79417 invoked from network); 14 Jun 2001 20:24:04 -0000 Received: from postbox.viquity.com (HELO hermes.viquity.com) (63.198.126.137) by h31.sny.collab.net with SMTP; 14 Jun 2001 20:24:04 -0000 Received: from dcsrv0.ecom2ecom.com (dcsrv0.viquity.com [10.0.0.1]) by hermes.viquity.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2650.21) id KTSKHQVB; Thu, 14 Jun 2001 13:25:50 -0700 Received: by dcsrv0 with Internet Mail Service (5.5.2650.21) id ; Thu, 14 Jun 2001 13:22:15 -0700 Message-ID: <635802DA64D4D31190D500508B9B0410821637@dcsrv0> From: William Kaufman To: "'tomcat-user@jakarta.apache.org'" Subject: RE: memory allocation Date: Thu, 14 Jun 2001 13:22:15 -0700 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: text/plain; charset="iso-8859-1" X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N The only time you need to set a variable to null is when the variable itself sticks around (e.g., a class variable, or an instance variable on some object on a class variable). You never have to null out local variables. This is a general Java question, not a Tomcat question. If my answer didn't make sense, ask on news:comp.lang.java.programmer, or on a Java mailing list. -- Bill K. -----Original Message----- From: Luba Powell [mailto:luba999@bellatlantic.net] Sent: Thursday, June 14, 2001 12:11 PM To: tomcat-user@jakarta.apache.org Subject: Re: memory allocation Not to worry. The only time that I know you need to set objects to null is when you write servers and inside you (while (true).. eternal loop. ----- Original Message ----- From: To: Sent: Thursday, June 14, 2001 1:41 PM Subject: memory allocation hi all , i want to ask something about jsp pages sample jsp code = ************************************************************** <%@ page import = "java.util.*" %> <%@ page import = "MyBean" %> <%@ page contentType="text/html;charset=ISO-8859-9" %> <% ArrayList al = new ArrayList(); mybean.showData(al); // we are going to fill ArrayList Iterator it = al.iterator(); while( it.hasNext() ) { %> <%=(String)it.next()%> <% } //while al = null ; // should i do this ? or is it going to be garbage collected by itself it = null ; // shoul i do this ? or is it going to be garbage collected by itself %> ************************************************************** my_bean object will be garbage collected because it' scope is page but what about ArrayList and Iterator objects ? thanks Regards Altug B. Altintas