< 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 releases the "inodes" Map, to avoid holding on to potentially large amounts of data
Reviewed-by:

@@ -487,10 +487,19 @@
         }
         synchronized (deflaters) {
             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) {
             for (Path p : tmppaths) {
                 try {
< prev index next >