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

Claes Redestad claes.redestad at oracle.com
Fri Mar 27 11:17:23 UTC 2020

Hi Tomasz,

this is deliberate and the observation that memory use seem to increase 
is caused by moving from a native to pure java-based implementation[1]
for zip/jar files in JDK 9. Mainly for stability purposes.

I'll note that the native implementation allocates similar and similarly
sized data structures, but they were hidden out of sight from tools
inspecting the java heap. So while total memory footprint should be more
or less neutral with the java-based implementation, there might be a
need to increase the java heap size to encompass the increased java
heap usage.



[1] https://bugs.openjdk.java.net/browse/JDK-8145260

On 2020-03-27 11: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?
> I couldn't post it to OpenJDK bug tracker, so I described the issue in detail here: https://stackoverflow.com/questions/60835946/why-is-java11-keeping-java-util-zip-zipfilesource-on-heap
> Regards
> Tomasz Poręba

More information about the discuss mailing list