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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P5 P5
    • 9
    • 9
    • hotspot
    • gc
    • b12

        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.

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

                Created:
                Updated:
                Resolved: