Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix JsonMemoryFootprintSpec with JDK 21 #929

Closed
wants to merge 1 commit into from

Conversation

xuwei-k
Copy link
Contributor

@xuwei-k xuwei-k commented Oct 9, 2023

Pull Request Checklist

  • Have you read through the contributor guidelines?
  • Have you squashed your commits?
  • Have you added copyright headers to new files?
  • Have you updated the documentation?
  • Have you added tests for any changed functionality?

Fixes

Purpose

pending some test if JDK 21 because fail.

Background Context

openjdk/jdk@17ce097#diff-cdf6d0587f1021c14e1af0d9cab581de2809cd1dbcf8bd87f5a5a304dc087263R333

add int putMode since JDK 21.

inspect java.util.LinkedHashMap by jol

JDK 17

java.util.LinkedHashMap object internals:
 OFFSET  SIZE       TYPE DESCRIPTION                    VALUE
      0     4            (object header)                01 00 00 00 (00000001 00000000 00000000 00000000) (1)
      4     4            (object header)                00 00 00 00 (00000000 00000000 00000000 00000000) (0)
      8     4            (object header)                d8 65 11 00 (11011000 01100101 00010001 00000000) (1140184)
     12     4        Set AbstractMap.keySet             (access denied)
     16     4 Collection AbstractMap.values             (access denied)
     20     4        int HashMap.size                   (access denied)
     24     4        int HashMap.modCount               (access denied)
     28     4        int HashMap.threshold              (access denied)
     32     4      float HashMap.loadFactor             (access denied)
     36     4     Node[] HashMap.table                  (access denied)
     40     4        Set HashMap.entrySet               (access denied)
     44     1    boolean LinkedHashMap.accessOrder      (access denied)
     45     3            (alignment/padding gap)        N/A
     48     4      Entry LinkedHashMap.head             (access denied)
     52     4      Entry LinkedHashMap.tail             (access denied)
Instance size: 56 bytes
Space losses: 3 bytes internal + 0 bytes external = 3 bytes total

JDK 21

java.util.LinkedHashMap object internals:
 OFFSET  SIZE       TYPE DESCRIPTION                    VALUE
      0     4            (object header)                01 00 00 00 (00000001 00000000 00000000 00000000) (1)
      4     4            (object header)                00 00 00 00 (00000000 00000000 00000000 00000000) (0)
      8     4            (object header)                b8 d7 0f 00 (10111000 11010111 00001111 00000000) (1038264)
     12     4        Set AbstractMap.keySet             (access denied)
     16     4 Collection AbstractMap.values             (access denied)
     20     4        int HashMap.size                   (access denied)
     24     4        int HashMap.modCount               (access denied)
     28     4        int HashMap.threshold              (access denied)
     32     4      float HashMap.loadFactor             (access denied)
     36     4     Node[] HashMap.table                  (access denied)
     40     4        Set HashMap.entrySet               (access denied)
     44     4        int LinkedHashMap.putMode          (access denied)
     48     1    boolean LinkedHashMap.accessOrder      (access denied)
     49     3            (alignment/padding gap)        N/A
     52     4      Entry LinkedHashMap.head             (access denied)
     56     4      Entry LinkedHashMap.tail             (access denied)
     60     4            (loss due to the next object alignment)
Instance size: 64 bytes
Space losses: 3 bytes internal + 4 bytes external = 7 bytes total

References

@mkurz mkurz mentioned this pull request Jan 16, 2024
@mkurz
Copy link
Member

mkurz commented Jan 16, 2024

Instead of making the tests pending on JDK21, how about testing against the actual values? See

@mkurz
Copy link
Member

mkurz commented May 3, 2024

Thanks again, however I merged

instead which makes a bit more sense in this case IMHO.

@mkurz mkurz closed this May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants