Commit 08cef22f authored by Mathieu Chartier's avatar Mathieu Chartier
Browse files

Fix concurrent start bytes race

Previously, we set concurrent start bytes to max int when we
requested a concurrent GC, but there was a race if another thread
was doing another GC and had already completed GrowForUtilization
but had not yet finished the GC. This meant that the thread doing
the GC would update the concurrent start bytes properly, but the
allocating thread would re-update it to max int. Then when the
concurrent GC thread woke up, it would call WaitForGcToComplete
and see that there was a collector running and avoid doing the
concurrent GC, leaving the concurrent start bytes set to max int.

This meant that there would be no more concurrent GC until either
the next explicit GC or the next GC for alloc.

The fix is to only set concurrent start bytes to max int inside of
the CollectGarbageInternal code such that there isn't any way for
two threads to race.

Bug: 17942071

(cherry picked from commit 0133ec45)

Change-Id: Ibc23dd2f937a2b5fda51ed064634c034dbb6e668
parent 46fdec13
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment