RFR 9: 8165641 : Deprecate Object.finalize
aph at redhat.com
Sun Mar 12 17:33:47 UTC 2017
On 12/03/17 16:40, Philip Race wrote:
> On 3/12/17, 3:07 AM, Andrew Haley wrote:
>> I guess "difficulty in properly triggering GC for non-memory resource
>> exhaustion" is closest to what I just described.
> This has long been an issue in the Java client area where native desktop
> resources or the like need to be managed carefully, but it is not just
> native window handles but any resource not managed by GC.
> So more precisely "non-Java Heap" resource exhaustion as you could
> allocate 2GB of native heap and the GC would not care at all if
> it were tied solely to a 32 byte finalizable Java object.
Indeed. For what it's worth, I have a plan to design and implement a
mechanism to allow native memory to be safely deallocated without
using finalization, but it's proving rather difficult to find a nice
way to design the API and make it fit the JMM. I hope to get it done
by JDK 10. :-)
More information about the core-libs-dev