On Thu, 26 Feb 2026 13:27:48 GMT, Sanne Grinovero <[email protected]> 
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

Reply via email to