Fixed race condition in setting dd_new_allocation
authorMaoni0 <maonis@microsoft.com>
Tue, 12 Jul 2016 21:39:07 +0000 (14:39 -0700)
committerMaoni0 <maonis@microsoft.com>
Tue, 12 Jul 2016 21:39:07 +0000 (14:39 -0700)
commit6497857d7365c1d7c0c0af283c9ddd61cd6370ed
tree05e44f105858b752a7983188e9eef8f681b09d77
parent5b909529659d201664a964adeaa53a7f1a8e6189
Fixed race condition in setting dd_new_allocation

Sequence:

+ At the end of BGC we call compute_new_dynamic_data then switch to
preempt, at this point dd_new_allocation isn't set yet;
+ an FGC happens and saves new_allocation in gc_new_allocation
+ FGC finishes and BGC keeps running and saves gc_new_allocation in
new_allocation

The fix is to finish filling in the values for new_allocations before
we allow an FGC to happen.

Should really get rid of gc_new_allocation in the future. I am making
this fix to unblock my work on the fragmentation stuff.

Commit migrated from https://github.com/dotnet/coreclr/commit/43c102efb157c6b6c39457284a17473388822725
src/coreclr/src/gc/gc.cpp