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

@@ -56,6 +56,19 @@ public class ReactBridge extends Countable {
super.dispose();
}
public void handleMemoryPressure(MemoryPressure level) {
switch (level) {
case MODERATE:
handleMemoryPressureModerate();
break;
case CRITICAL:
handleMemoryPressureCritical();
break;
default:
throw new IllegalArgumentException("Unknown level: " + level);
}
}
private native void initialize(
JavaScriptExecutor jsExecutor,
ReactCallback callback,
@@ -72,4 +85,6 @@ public class ReactBridge extends Countable {
public native boolean supportsProfiling();
public native void startProfiler(String title);
public native void stopProfiler(String title, String filename);
private native void handleMemoryPressureModerate();
private native void handleMemoryPressureCritical();
}