RFR: 8378759: Make ZipFile.CleanableResource.inflaterCache field final

Eirik Bjørsnøs eirbjo at openjdk.org
Thu Feb 26 13:34:58 UTC 2026


On Thu, 26 Feb 2026 13:27:48 GMT, Sanne Grinovero <sgrinovero at openjdk.org> wrote:

> I agree that the pattern you propose looks easier to maintain, but I'm concerned about this possibly holding on to memory unnecessarily.

If the cleaning action is run from the Cleaner machinery, then the ZipFile is claimed by GC so no memory is being held on to. If the cleaning action is run from `ZipFile.close()`, then the ZipFile is no longer "usable" and client code should have no good reason to maintain references to the ZipFile.

That said, sure, we can trim the ArrayList to remove any large Object[] for the elements.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/29937#discussion_r2859060808


More information about the core-libs-dev mailing list