james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Noel J. Bergman" <n...@devtech.com>
Subject RE: [jira] Commented: (JAMES-248) memory management - finalize/nullify after successful delivery of retrieved MailImpl
Date Thu, 08 Apr 2004 17:35:19 GMT
> > Java does not guarantee that finalizers run, and it certainly
> > does not guarantee that they will run before Java decides to
> > garbage collect that object.

> Are you sure?

Yes, but you misunderstood, and my phrasing wasn't clear.

  "The Java programming language does not specify how soon a finalizer
  will be invoked, except to say that it will happen before the storage
  for the object is reused."

In other words, you cannot count on Java to call the finalize method if it
has not yet decided to garbage collect the object.  One of the aspects of
garbage collection is determining that an object is no longer reachable, and
the earliest that a finalizer would be called is when that determination has
been made.

The use of a PhantomReference is considered a more reliable approach.  That
mechanism is keyed by the determination that an object is no longer
reachable except via a PhantomReference.

for more details.

	--- Noel

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

View raw message