Skip to content
Commit a2934d5f authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

Cache AndroidBlockGuardPolicy to avoid allocation.

Every incoming Binder call ends up triggering a BlockGuardPolicy
update, which would thrash between new AndroidBlockGuardPolicy
instances and BlockGuard.LAX_POLICY, causing GC churn.

This change avoids the extra allocations by recycling a single
AndroidBlockGuardPolicy in a ThreadLocal.  Worst-case thrashing case
is now 10% faster; from 7.46us to 6.65us.

Bug: 9424568
Change-Id: I9c3b1c097a2aecc9b1f109a824cf3ea319fb3393
parent b28f8c82
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment