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

G1CardLiveData::free_large_bitmap() uses wrong calculation to determine the number of words

XMLWordPrintable

    • gc
    • b120

      G1CardLiveData::bm_word_t* G1CardLiveData::allocate_large_bitmap(size_t size_in_bits) {
        size_t size_in_words = BitMap::calc_size_in_words(size_in_bits);

        bm_word_t* map = MmapArrayAllocator<bm_word_t, mtGC>::allocate(size_in_words);

        return map;
      }

      void G1CardLiveData::free_large_bitmap(bm_word_t* bitmap, size_t size_in_bits) {
        MmapArrayAllocator<bm_word_t, mtGC>::free(bitmap, size_in_bits / BitsPerWord);
      }

      The calculation of the number of elements in free_large_bitmap() is different to the one of allocate_large_bitmap().

      The calculation itself is correct, as size_in_bits is always word aligned for all callers.

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

              Created:
              Updated:
              Resolved: