Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix finalizer issue with regions #54550

Merged
merged 2 commits into from
Jun 23, 2021

Commits on Jun 22, 2021

  1. This fixes an issue in Server GC where an item in the finalizer queue…

    … became stale due to not being relocated.
    
    The problem was that a finalizable object was allocated on one heap, but registered in the finalizer queue of another heap (this is possible due to heap balancing). In CFinalize::UpdatePromotedGenerations, we ask for the generation of an object, and move the object to the correct section of the finalizer queue. In the error case, we obtained the wrong result for the generation of the object because it lives on another heap, and that heap hadn't set the final generation for the region containing the object yet.
    
    The fix simply fetches the heap from the alloc context after the allocation. That is the correct heap to register the object on.
    PeterSolMS committed Jun 22, 2021
    Configuration menu
    Copy the full SHA
    5a043d3 View commit details
    Browse the repository at this point in the history
  2. Make sure we obtain the correct heap for LOH/POH allocations as well,…

    … add assert to enforce the invariant that we register the finalizable object on the heap it was allocated on.
    PeterSolMS committed Jun 22, 2021
    Configuration menu
    Copy the full SHA
    415405b View commit details
    Browse the repository at this point in the history