Only count uncleared ProxyMap refs when deciding to crash
Add a method to compute the size of a ProxyMap without cleared
references. Use it in the crash decision. Report both counts, as
well as the count after a forced GC before actually crashing.
Rename the histogram generating function after a small refactoring
to make that easier.
When we crash, we now generate a message like the following
(generated here with reduced thresholds):
01-03 01:40:52.273 4793 4947 E JavaBinder: java.lang.AssertionError:
Binder ProxyMap has too many entries: 277 (total), 275 (uncleared),
257 (after GC). BinderProxy leak?
after the histogram. Unfortunately, the intervening GC may take some
time, and other intervening messages may sneak into the log between
them.
Experiments so far suggest that none of this greatly affects the
decision when to die. But this eliminates uncertainty as to whether
there was really a problem.
Bug: 71353150
Test: Tested with reduced thresholds, and then booted AOSP.
Change-Id: I53f24bae23eedcdb78a1c32296c65692b7bb2c42
1 file changed