robolectric / robolectric

Android Unit Testing Framework
http://robolectric.org
Other
5.81k stars 1.36k forks source link

Fixes memory leak issue in ThreadedRenderer. #9080

Closed copybara-service[bot] closed 2 weeks ago

copybara-service[bot] commented 2 weeks ago

Fixes memory leak issue in ThreadedRenderer.

ThreadedRenderer calls ProcessInitializer.init in its create method. This internal class holds a reference to the context, which thus holds a reference to the activity we created. It never gets cleaned up because it is a static singleton. This inner class doesn't really do anything useful in Robolectric, so to fix it we simply clear out the init function so it doesn't save a reference to the context.