Avoid a long alloc space lock contention during sticky GC sweep.
The lock contention logging systrace support (b/9986464) indicates
that under the Ritz allocation benchmark the alloc space lock contends
rather long (up to ~10 ms on Nexus 4) in a single lump during each
sticky GC sweep. This is because all the dead objects in the
allocation stack are freed in one FreeList() call. While the lock
contention isn't a GC pause and may only be an issue with a
high-allocation application like Ritz, it'd stall any application
threads that attempt to allocate during the contention and would be
bad for jank. I think it's better to free the objects incrementally in
chunks and interleave the GC thread and application threads.
This change does not speed up or slow down the Ritz allocation
1 file changed