[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: More finalize woes
From: |
Stephen Crawley |
Subject: |
Re: More finalize woes |
Date: |
Fri, 07 Mar 2003 13:48:29 +1000 |
> IIRC all objects technicaly have finalizer. The question is which
> objects have non-trivial finalizers. If (to allow changing class
> hierarchies as above) you require all classes to contain:
>
> public void finalize () { super.finalize(); }
The JLS spec calls that a trivial finalizer ...
> (which is a logical extension of what you said),
It is NOT a logical extension of what I'm saying. I'm saying that
non-trivial finalizers should always include a call to super.finalize().
It does NOT follow that every class should have a finalizer.
Adding a trivial finalizer does NOT help in the event that the
programmer changes the classes position in the class hierarchy.
But having a (previously redundant) super.finalize() call in a
non-trivial finalize method may turn out to be a GOOD THING.
> I'm not sure what "setting up the stacks etcetera" refers to.
> However, objects with (non-trivial) finalizers are quite expensive
> in many Java implementations.
Yes ... but 90% of the cost is incurred before the most-derived
finalizer is called, or after it returns. And even when the finalizer
is called, the cost of executing the instance's finalization code will
be far greater than the cost of a call to java.lang.Object.finalize
... which is going to return in a JVM instruction or two.
-- Steve
- Re: More finalize woes, (continued)
- Re: More finalize woes, Dalibor Topic, 2003/03/06
- Re: More finalize woes, Chris Gray, 2003/03/06
- Re: More finalize woes, Tom Tromey, 2003/03/06
- Re: More finalize woes, Sascha Brawer, 2003/03/06
- Re: More finalize woes, Artur Biesiadowski, 2003/03/06
- Re: More finalize woes, Stephen Crawley, 2003/03/06
- Re: More finalize woes, Per Bothner, 2003/03/06
- Re: More finalize woes, Stephen Crawley, 2003/03/06
- Re: More finalize woes, Stephen Crawley, 2003/03/06
- Re: More finalize woes, Per Bothner, 2003/03/06
- Re: More finalize woes,
Stephen Crawley <=
- Re: More finalize woes, Per Bothner, 2003/03/07
- Re: More finalize woes, Tom Tromey, 2003/03/06
- Re: More finalize woes, Brian Jones, 2003/03/06
- Re: More finalize woes, Per Bothner, 2003/03/07
- Re: More finalize woes, Chris Gray, 2003/03/07
- Re: More finalize woes, Stephen Crawley, 2003/03/09
RE: More finalize woes, Jeroen Frijters, 2003/03/04