mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-02-11 09:11:14 +08:00
Trigger GC and drop compiled code on low memory
Reviewed By: astreet Differential Revision: D2658693 fb-gh-sync-id: 8cba49b67ac45a2dbf8b4c9c404d6fb9c97693f6
This commit is contained in:
committed by
facebook-github-bot-5
parent
611e0619ca
commit
510d50fc17
@@ -100,6 +100,7 @@ import com.facebook.systrace.Systrace;
|
||||
new ConcurrentLinkedQueue<>();
|
||||
private volatile boolean mHasStartedCreatingInitialContext = false;
|
||||
private final UIImplementationProvider mUIImplementationProvider;
|
||||
private final MemoryPressureRouter mMemoryPressureRouter;
|
||||
|
||||
private final ReactInstanceDevCommandsHandler mDevInterface =
|
||||
new ReactInstanceDevCommandsHandler() {
|
||||
@@ -215,6 +216,7 @@ import com.facebook.systrace.Systrace;
|
||||
mBridgeIdleDebugListener = bridgeIdleDebugListener;
|
||||
mLifecycleState = initialLifecycleState;
|
||||
mUIImplementationProvider = uiImplementationProvider;
|
||||
mMemoryPressureRouter = new MemoryPressureRouter(applicationContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -400,6 +402,7 @@ import com.facebook.systrace.Systrace;
|
||||
public void onDestroy() {
|
||||
UiThreadUtil.assertOnUiThread();
|
||||
|
||||
mMemoryPressureRouter.destroy(mApplicationContext);
|
||||
if (mUseDeveloperSupport) {
|
||||
mDevSupportManager.setDevSupportEnabled(false);
|
||||
}
|
||||
@@ -539,6 +542,7 @@ import com.facebook.systrace.Systrace;
|
||||
|
||||
catalystInstance.initialize();
|
||||
mDevSupportManager.onNewReactContextCreated(reactContext);
|
||||
mMemoryPressureRouter.onNewReactContextCreated(reactContext);
|
||||
moveReactContextToCurrentLifecycleState(reactContext);
|
||||
|
||||
for (ReactRootView rootView : mAttachedRootViews) {
|
||||
@@ -591,6 +595,7 @@ import com.facebook.systrace.Systrace;
|
||||
}
|
||||
reactContext.onDestroy();
|
||||
mDevSupportManager.onReactInstanceDestroyed(reactContext);
|
||||
mMemoryPressureRouter.onReactInstanceDestroyed();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user