Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
clear controller state on final unmount
Summary: The most recent run of the nested tree experiment was increasing OOMs [[scuba](https://fburl.com/scuba/errorreporting_facebook_android_crashes/f74yx517)]. {F1471144788} On checking heap dumps from test groups [[query](https://fburl.com/scuba/omura_facebook_hprof_files/dlhejwgk)], we saw a number of `TreeState` objects being kept around in memory. {F1471146040} The inference is that the controller never clears the latest committed state when the nested tree is unmounted. This leads to more `TreeState` objects being accumulated in memory as more nested trees are rendered until the app OOMs. This also explains why the OOM was more prevalent on surfaces like Newsfeed and the Goodwill throwback screen. They tend to have a significant number of NT and Bloks units and can regularly unmount and remount new generations by way of refreshing. This diff attaches a release listener to the controller and clears the committed tree state as soon as the nested tree is released Reviewed By: adityasharat Differential Revision: D55143679 fbshipit-source-id: 294fb9e713ba928ca92228e355e037ee5a5a9de4
- Loading branch information