Thank you for reporting this issue and providing the details. I have created https://bugs.openjdk.org/browse/JDK-8353787 to track this. Any fixes done related to this issue will be first done against the mainline JDK and the project members that manage the update releases (https://openjdk.org/projects/jdk-updates/) will then decide if/when this change should be backported.

-Jaikiran

On 04/04/25 11:55 pm, Ayman wrote:
Yes, I started looking into this because of a memory regression.
While upgrading our project from Java 17 to Java 21, I noticed an increase in memory consumption. After dumping the heap and analyzing the differences, I found that there are a few thousand instances of the class "java.util.jar.Attributes$Name" which all contain the same string which is "SHA-384-Digest". In our case, it was a 2MB increase in a process that uses 35MB normally so that's almost a 5% increase. The issue here is that we are loading multiple jars that each contain a MANIFEST file which contains hundreds of classes and so many times the string "SHA-384-Digest".

It would be nice if the fix could be backported to java 21 since it's the current LTS that's impacted.

On Fri, Apr 4, 2025 at 7:07 PM Jaikiran Pai <jai.forums2...@gmail.com> wrote:

    The caching of some attribute names in the java.util.jar.Attributes
    class appears to have been introduced in
    https://bugs.openjdk.org/browse/JDK-6805750 (RFR
    https://mail.openjdk.org/pipermail/core-libs-dev/2018-April/052697.html).

    Given the precedence, it may be OK to add "SHA-384-Digest" to that
    set,
    but I don't know how much (if any) would it help with the
    performance.
    Did you happen to notice any performance issues which prompted you to
    look at this cache?

    -Jaikiran

    On 04/04/25 10:25 pm, Jaikiran Pai wrote:
    > Since this is about caching values in the java.util.jar.Attributes
    > class, the discussion is more appropriate in the core-libs-dev
    mailing
    > list. I've added it to the "To" now and "Bcc"ed the jdk-dev mailing
    > list. Please subscribe to core-libs-dev
    > https://mail.openjdk.org/mailman/listinfo/core-libs-dev if you
    haven't
    > already and we can continue the discussion there.
    >
    > -Jaikiran
    >
    > On 04/04/25 8:54 pm, Ayman wrote:
    >> Hello,
    >>
    >> Starting from JDK 19, SHA-384 is replacing SHA-256 as the default
    >> digest algorithm in the jarsigner:
    >> https://bugs.openjdk.org/browse/JDK-8283475
    >>
    >> This means that the string "SHA-384" is now written multiples
    times
    >> is the MANIFEST files, this has been tackled in the past by adding
    >> the string "SHA-256" as a KNOWN_NAME that shouldn't be
    duplicated in
    >> memory:
    >>
    
https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/java/util/jar/Attributes.java#L729

    >>
    >>
    >> Is it possible to do the same with "SHA-384"?
    >>
    >> Thanks,

Reply via email to