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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 20
    • 20
    • 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.

            iwalulya Ivan Walulya
            kbarrett Kim Barrett
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: