Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8243535

NMT may show wrong numbers for CDS and CCS


    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 15
    • Fix Version/s: 15
    • Component/s: hotspot
    • Subcomponent:
    • Resolved In Build:



        NMT is not able to correctly follow os::split_reserved_memory operations.

        os::split_reserved_memory() is used when a ReservedSpace is split in two with the "split" parameter set to true, which we (only) use when CDS reserves space for class space and archives together and then splits those regions up.

        On Posix platforms, os::split_reserved_memory() is a noop since no interaction with the OS is needed. Therefore, to NMT, this split is invisible.

        So we cannot split a region and then track those regions with different NMT flags. The effect of this error is that in the NMT summary "mtShared" and "Class" may be wrong:


        ../../jdks/sapmachine14/bin/java -XX:CompressedClassSpaceSize=3G -XX:NativeMemoryTracking=summary -XX:+UnlockDiagnosticVMOptions -XX:+PrintNMTStatistics -Xlog:cds*,gc+metaspace=trace -XX:ArchiveRelocationMode=1
        Native Memory Tracking:

        Total: reserved=7730887KB, committed=347843KB
        - Java Heap (reserved=4091904KB, committed=258048KB)
                                    (mmap: reserved=4091904KB, committed=258048KB)
        - Class (reserved=8302KB, committed=4462KB)
                                    (classes #652)
                                    ( instance classes #552, array classes #100)
                                    (malloc=110KB #738)
                                    (mmap: reserved=8192KB, committed=4352KB)
                                    ( Metadata: )
                                    ( reserved=8192KB, committed=4352KB)
                                    ( used=254KB)
                                    ( free=4098KB)
                                    ( waste=0KB =0,00%)
                                    ( Class space:)
                                    ( reserved=3145728KB, committed=512KB)
                                    ( used=24KB)
                                    ( free=488KB)
                                    ( waste=0KB =0,00%)
        - Thread (reserved=18553KB, committed=833KB)
                                    (thread #18)
                                    (stack: reserved=18472KB, committed=752KB)
                                    (malloc=61KB #110)
                                    (arena=19KB #34)
        - Code (reserved=247736KB, committed=7596KB)
                                    (malloc=48KB #492)
                                    (mmap: reserved=247688KB, committed=7548KB)
        - GC (reserved=203613KB, committed=61341KB)
                                    (malloc=17965KB #2148)
                                    (mmap: reserved=185648KB, committed=43376KB)
        - Compiler (reserved=332KB, committed=332KB)
                                    (malloc=3KB #44)
                                    (arena=329KB #10)
        - Internal (reserved=1440KB, committed=1440KB)
                                    (malloc=1404KB #988)
                                    (mmap: reserved=36KB, committed=36KB)
        - Symbol (reserved=1136KB, committed=1136KB)
                                    (malloc=776KB #246)
                                    (arena=360KB #1)
        - Native Memory Tracking (reserved=111KB, committed=111KB)
                                    (malloc=5KB #71)
                                    (tracking overhead=106KB)
        - Shared class space (reserved=3157028KB, committed=11812KB)
                                    (mmap: reserved=3157028KB, committed=11812KB)
        - Arena Chunk (reserved=618KB, committed=618KB)
        - Logging (reserved=5KB, committed=5KB)
                                    (malloc=5KB #198)
        - Arguments (reserved=13KB, committed=13KB)
                                    (malloc=13KB #431)
        - Module (reserved=59KB, committed=59KB)
                                    (malloc=59KB #1035)
        - Safepoint (reserved=8KB, committed=8KB)
                                    (mmap: reserved=8KB, committed=8KB)
        - Synchronization (reserved=28KB, committed=28KB)
                                    (malloc=28KB #181)

        We reserve 3G of compressed class space, but the 3G show up as reserved area under "Shared Classes". This only happens when we artificially disable the common cds base address with ArchiveRelocationMode=1, because otherwise CDS just creates two mappings.


            Issue Links



                • Assignee:
                  stuefe Thomas Stuefe
                  stuefe Thomas Stuefe
                • Votes:
                  0 Vote for this issue
                  4 Start watching this issue


                  • Created: