< prev index next >

src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java

Print this page
rev 57619 : 7143743: (zipfs) Potential memory leak with zip provider
Summary: ZipFileSystem.close() now clears the "inodes" Map, to avoid holding on to potentially large amounts of data
Reviewed-by:

@@ -487,10 +487,18 @@
         }
         synchronized (deflaters) {
             for (Deflater def : deflaters)
                 def.end();
         }
+        beginWrite(); // lock and sync
+        try {
+            // clear the inodes since they can potentially hold on to large amounts
+            // of data (especially IndexNode of type ZipFileSystem$Entry)
+            inodes.clear();
+        } finally {
+            endWrite();
+        }
 
         IOException ioe = null;
         synchronized (tmppaths) {
             for (Path p : tmppaths) {
                 try {
< prev index next >