tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Warren Crossing <Warr...@nocode.com.au>
Subject RE: memory allocation
Date Thu, 14 Jun 2001 23:50:53 GMT
um.. i'm pretty sure that it doesn't matter. 
the system garbage collector MAY reap memory for objects that are set to
null.
remember once the service method executes all the method variables ( al & it
)  go out of scope and are elegible for gc.
if you had static or class level members using <%! %> tags then they would
not be gc until their references were nullafied.
hope this helps.

warren. 

-----Original Message-----
From: altuga@koc.net [mailto:altuga@koc.net]
Sent: Friday, 15 June 2001 5:09 AM
To: tomcat-user@jakarta.apache.org
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" %>


<jsp:useBean id="my_bean" class="MyBean" scope="page"/>

<html>
<head>

	<%  
			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 

	%>
</head>
</html>
**************************************************************

my_bean  object will be garbage collected  because it' scope is page but
what about  ArrayList and Iterator  objects  ? 

thanks 

Regards

Altug
 

Mime
View raw message