> does java not guarantee that everything will be garbage collected
> eventually? Even if that is not until program exit?

See: Runtime.runFinalizersOnExit().  There is no guarantee that finalizers
will be called, unless you use that deprecated and unreliable method.

I don't know if there is a guarantee that PhantomReference handling will
occur at JVM shutdown, either.  See Runtime.exit(int) for a description of
the exit sequence.  But there is also
Runtime.getRuntime().addShutdownHook(), and that could be used.

Martin Cooper raised the same concern, related to code that we are using in
Jakarta Commons.  I am looking at the code that I gave to Martin that uses
PhantomReferences, and see where a shutdown hook (JDK 1.3+) could apply.  It
should be able to process any remaining PhantomReference instances.

        --- Noel


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to