Non-local G1MonotonicArenaFreePool::_freelist_pool has non-trivial ctor/dtor

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P4
    • 20
    • Affects Version/s: 20
    • Component/s: hotspot
    • gc
    • b27

      G1MonotonicArenaFreePool is a class with non-trivial ctor and dtor. G1MonotonicArenaFreePool::_freelist_pool is a variable with static duration of this type. Such a variable is contrary to the HotSpot Style Guide, because it introduces static initialization order issues and destruction on exit issues.

      The Style Guide says:

      * Avoid non-local variables with non-constexpr initialization. In particular, avoid variables with types requiring non-trivial initialization or destruction. Initialization order problems can be difficult to deal with and lead to surprises, as can destruction ordering. HotSpot doesn't generally try to cleanup on exit, and running destructors at exit can also lead to problems.

            Assignee:
            Ivan Walulya
            Reporter:
            Kim Barrett
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: