# HG changeset patch # User jpai # Date 1578734573 -19800 # Sat Jan 11 14:52:53 2020 +0530 # Node ID a3b9f5d86605700f81b4bb0f3c40a7a6b1798f31 # Parent f7edb9ca045cb240d8e0ee9d5c1c1f92820da7b6 7143743: (zipfs) Potential memory leak with zip provider Summary: ZipFileSystem.close() now releases the "inodes" Map, to avoid holding on to potentially large amounts of data Reviewed-by: diff --git a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java --- a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java +++ b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java @@ -489,6 +489,15 @@ for (Deflater def : deflaters) def.end(); } + beginWrite(); // lock and sync + try { + // dereference the inodes map, since each entry in that map + // can potentially hold on to large amounts of data (especially + // IndexNode of type ZipFileSystem$Entry) + inodes = null; + } finally { + endWrite(); + } IOException ioe = null; synchronized (tmppaths) {