Trigger garbage collection when the app receive memory warning

Summary:
Changelog: [internal]

The condition inside `[RCTCxxBridge handleMemoryWarning]` was preventing JS VM from handling memory pressure if React Native was loading. This seems incorrect as loading only occurs once at the startup but memory pressure event occurs mostly after React Native was initialised. Therefore, JS VM wasn't handling memory pressure events.

Reviewed By: shergin

Differential Revision: D24646724

fbshipit-source-id: 7b4420fe675261e434c3427c8ad366ba0086a453
This commit is contained in:
Samuel Susla
2020-10-30 08:16:58 -07:00
committed by Facebook GitHub Bot
parent be8fe21d06
commit 96ecad4341
+3 -1
View File
@@ -310,7 +310,9 @@ struct RCTInstanceCallback : public InstanceCallback {
- (void)handleMemoryWarning
{
if (!_valid || !_loading) {
// We only want to run garbage collector when the loading is finished
// and the instance is valid.
if (!_valid || _loading) {
return;
}