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

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

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 12
    • None
    • 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()

            dchuyko Dmitry Chuyko
            dchuyko Dmitry Chuyko
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: