Why is Java11 keeping java.util.zip.ZipFile$Source on heap?

Alan Bateman Alan.Bateman at oracle.com
Fri Mar 27 11:27:39 UTC 2020

On 27/03/2020 10:27, Poreba, Tomasz wrote:
> I noticed that after migrating a Java app from JDK8 to JDK11 a significant portion of heap is being used up by some data related to my jars from the classpath.
> These are byte[] from java.util.zip.ZipFile$Source (field "cen"), it appears that static map "files" keeps them.
> Is it deliberate?
ZipFile was significantly re-implemented in 2015 (for JDK 9) to remove 
JNI overhead and also the problematic memory mapping of the ZIP file 
central directory. So yes, you will see a difference between the native 
and heap usage. The core-libs-dev mailing list is the place to being 
issues if you find a memory leak or bugs.


More information about the discuss mailing list