Don't use memset to initialize arrays of MemoryUsage in memoryManager.cpp

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Fixed
    • Priority: P4
    • 12
    • Affects Version/s: None
    • Component/s: hotspot
    • None
    • gc
    • b22

        gcc8 warnings:

        In multiple places there are errors reported like:

        src/hotspot/share/services/memoryManager.cpp:172:40: error: ‘void* memset(void*, int, size_t)’ clearing an object of non-trivial type ‘class MemoryUsage’; use assignment or value-initialization instead [-Werror=class-memaccess]
           memset(_before_gc_usage_array, 0, len);
                                                ^

        These could be fixed using placement new, e.g.

          ::new (_before_gc_usage_array) MemoryUsage()

              Assignee:
              Dmitry Chuyko
              Reporter:
              Dmitry Chuyko
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: