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

G1CollectorPolicy uses uninitialized field '_sigma' in the constructor

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • 9
    • hotspot
    • gc
    • b48

        The G1CollectorPolicy constructor uses a huge initializer list. In this list it calls "new SurvRateGroup(this, ..)" passing passing it a reference to the no yet fully initialized G1CollectorPolicy instance.

        Via the following call chain, the SurvRateGroup constructor calls back to G1CollectorPolicy::get_new_prediction() which uses the uninitialzed value of G1CollectorPolicy::_sigma:

        G1CollectorPolicy::G1CollectorPolicy
        SurvRateGroup::SurvRateGroup
        SurvRateGroup::reset
        SurvRateGroup::all_surviving_words_recorded
        G1CollectorPolicy::get_new_prediction

        Depending on the indefinite value of '_sigma' this can lead to situations, where a GC is triggered before the whole system is initialized and ready for a GC resulting in the following crash:

        Error occurred during initialization of VM
        GC triggered before VM initialization completed. Try increasing NewSize, current value 5324K.

        The fix is trivial - initialize the G1CollectorPolicy members in the right order

              simonis Volker Simonis
              simonis Volker Simonis
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: