diff --git a/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java b/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java index 4d2ed232c0779a3122f70732c2507ffe48a02a4e..756c9a641c7ff209c32cd2fb78bc7ddaaeb3221b 100644 --- a/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java +++ b/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2020, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -289,6 +289,14 @@ public class ZipFileSystem extends FileSystem { def.end(); } + beginWrite(); // lock and sync + try { + // Clear the map so that its keys & values can be garbage collected + inodes = null; + } finally { + endWrite(); + } + IOException ioe = null; synchronized (tmppaths) { for (Path p: tmppaths) {