Fix accounting issue with sweep_region_in_plan. (#56910)
authorPeter Sollich <petersol@microsoft.com>
Fri, 6 Aug 2021 11:11:23 +0000 (13:11 +0200)
committerGitHub <noreply@github.com>
Fri, 6 Aug 2021 11:11:23 +0000 (13:11 +0200)
commit5f417142b0b90da0d1d75c21a583cf8d9e54c4d6
tree07e641b4bfe40f4e6970db878176fbe5762f4912
parent22cee85aa08061e5b2c1e893797a860e3c642e6c
Fix accounting issue with sweep_region_in_plan. (#56910)

The free list items that we find while doing sweep_region_in_plan are kept on a per-region free list temporarily and later transferred to the per-generation allocator.

We also need to keep track of the free list space and the free obj space to make the accounting work out - otherwise we have items on the per-generation allocator that are unaccounted for, and the per-generation free obj space may become negative. Both cause us to overestimate fragmentation and thus do unnecessary blocking GCs.
src/coreclr/gc/gc.cpp
src/coreclr/gc/gcpriv.h