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

G1: Memory usage calculation uses sizeof(this) instead of sizeof(classname)

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P5
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: hotspot
    • Labels:
    • Subcomponent:
      gc
    • Resolved In Build:
      b12

      Backports

        Description

        After JDK-8038930 the calculation of the static memory used by the code root chunk manager is wrong: instead of

         86 size_t G1CodeRootChunkManager::static_mem_size() {
         87 return sizeof(this);
         88 }

        Also in other places the code uses sizeof(this) instead of sizeof(class name), e.g.

        $ grep -r "sizeof(this)" src/share/vm/gc_implementation/g1/
        src/share/vm/gc_implementation/g1/sparsePRT.cpp: return sizeof(this) +
        src/share/vm/gc_implementation/g1/sparsePRT.cpp: return sizeof(this) +_next->mem_size();
        src/share/vm/gc_implementation/g1/g1CodeCacheRemSet.cpp: return sizeof(this);
        src/share/vm/gc_implementation/g1/g1CodeCacheRemSet.cpp: return sizeof(this) + _list.count() * _list.size();
        src/share/vm/gc_implementation/g1/heapRegionRemSet.hpp: + (sizeof(this) - sizeof(OtherRegionsTable))
        src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp: return sizeof(this) + _bm.size_in_words() * HeapWordSize;

        All these terms are wrong, should use sizeof(*this) or sizeof(class name).

        Fix this.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  tschatzl Thomas Schatzl
                  Reporter:
                  tschatzl Thomas Schatzl
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: