Clear spiedInstance field for spyOn objects.
All spyOn instances are directly returned as the mock, and put in the mock map with a strong ref in the value of the map. Due to the strong ref in the value the mock map won't purge that item. Note this is not a complete solution, for the same reason as its parent commit. MockCreationListner is registered to a ThreadLocal, so we can only track mocks created in the same thread where it's registered. That includes all befores and afters, but we basically lose all mocks created in test cases because they're run with timeout in a different thread. They are mostly ActivityRecords. Bug: 123984854 Test: Smaller memory pressure shown in mem dump. Change-Id: If3c488a23ab9c59a63d9844fc995e4bb0313896a
Loading
Please register or sign in to comment