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:
Alexander Blom
2015-12-07 08:43:24 -08:00
committed by facebook-github-bot-5
parent 611e0619ca
commit 510d50fc17
12 changed files with 182 additions and 3 deletions

View File

@@ -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();
}
/**