james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Serge Knystautas <ser...@lokitech.com>
Subject Re: [jira] Commented: (JAMES-248) memory management - finalize/nullify after successful delivery of retrieved MailImpl
Date Thu, 08 Apr 2004 18:18:33 GMT
Kerr Rainey wrote:
> OK, yes I understand that you cannot guarantee when an object will be 
> garbage collected, but does java not guarantee that everything will be 
> garbage collected eventually? Even if that is not until program exit? To 
> be honest, I'm not sure about this. I'd certainly hope any reasonable 
> implementation would do this. Too expectant?
> 
> Obviously if you have expensive resources tied up you probably want to 
> guarantee that they get released in a much more timely fashion ;)

Honestly I've lost context of what the resource is you were trying to 
release, so I'm just making general comments at this point.

Everything would /eventually/ get GC'd... but eventually is a long and 
non-guaranteed time.  If you're dealing with something expensive, such 
as file-handles on a server, you'd want to handle this explicitly.

I think finalize() is perceived as a "less than ideal" design pattern at 
this point.  It might be ok if you're dealing with a client app, where 
an extra file handle or socket connection could get cleaned up 
"eventually."  But in a mailet, it's probably something to avoid.

Also, I just find this part very, very interesting... finalize() can 
really hurt performance with respect to your garbage collector.  Objects 
that have a finalize call survive through multiple generations where 
they otherwise would get immediately destroyed.

http://www-106.ibm.com/developerworks/java/library/j-jtp01274.html

-- 
Serge Knystautas
President
Lokitech >> software . strategy . design >> http://www.lokitech.com
p. 301.656.5501
e. sergek@lokitech.com

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message