Use stable objects for callbacks
Fixes a memory leak contributing to b/419430883. In Android's Runtime, method references are not stable across callsites. Concretely If you register (this::fun) and unregister (this::fun), this may lead to twice as much fun as you bargained for. The lambda instances generated for register and unregister are NOT equal! This leads to memory leaks as the registration works but the deregistration is not recognised, leading to everlasting fun. Bug: 419430883 Test: atest WMShellUnitTests # sufficiently large to trigger the leak Flag: android.tracing.client_side_proto_logging Change-Id: Idc478fdf60985d86144e9ec317b198a038f60b1e
Loading
Please register or sign in to comment