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

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

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 12
    • Component/s: hotspot
    • Labels:
      None
    • Subcomponent:
      gc
    • Resolved In Build:
      b22

      Description

      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()

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                dchuyko Dmitry Chuyko
                Reporter:
                dchuyko Dmitry Chuyko
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: