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

Poreba, Tomasz Tomasz.Poreba at siemens-logistics.com
Fri Mar 27 11:21:11 UTC 2020

OK, this makes sense. 
I will estimate the additional footprint and increase my Xmx accordingly.

Would you mind if I put your explanation as an answer to my stackoverflow question?

> -----Original Message-----
> From: Claes Redestad <claes.redestad at oracle.com>
> Sent: Friday, March 27, 2020 12:17
> To: Poreba, Tomasz (SL DB DL TEC R&D-AX4 SD2) <Tomasz.Poreba at siemens-
> logistics.com>; discuss at openjdk.java.net
> Subject: Re: Why is Java11 keeping java.util.zip.ZipFile$Source on heap?
> 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.
> Regards
> /Claes
> [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