mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-21 08:22:45 +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
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user