RFR 9: 8165641 : Deprecate Object.finalize

Andrew Haley aph at redhat.com
Tue Mar 14 10:14:18 UTC 2017

On 12/03/17 23:55, Hans Boehm wrote:

> But I think we agree that it doesn't matter for this discussion;
> neither of these problems are addressed by deprecating
> finalizers. PhantomReferences have exactly the same issues. And in
> my experience it's unfortunately unrealistic to say we're going to
> use neither. There will be Java wrappers for native objects. And
> they will be embedded in Java data structures.  Requiring explicit
> management for those amounts to mostly throwing out Java garbage
> collection.

Not exactly: Java garbage collection is great for what it was intended
to do, i.e. managing memory.  It's terrible for managing other scarce
resources such as file handles.  There are much better ways to do
that: explicit resource acquisition, good old-fashioned reference
counting, etc.


More information about the core-libs-dev mailing list