You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[camerax] Shorten interval for releasing weak references to Dart-wrapped native objects (flutter#6493)
This PR:
1. Shortens the `InstanceManager`'s default time interval that it waits to remove references to Dart-wrapped Android native objects. The shortened interval matches `webview_flutter_android`s `InstanceManager`; because it has been tested by that plugin, we expect it not to impact performance and this could help reduce overall memory usage by the plugin.
2. Dynamically shortens that same time interval whenever image streaming is started/stopped to account for the increased memory usage that this camera use case requires.
Fixesflutter/flutter#145893.
Copy file name to clipboardExpand all lines: packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/ImageAnalysisHostApiImpl.java
+15Lines changed: 15 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -69,6 +69,14 @@ public void setAnalyzer(@NonNull Long identifier, @NonNull Long analyzerIdentifi
69
69
thrownewIllegalStateException("Context must be set to set an Analyzer.");
70
70
}
71
71
72
+
// Shorten time interval used to define how often the instanceManager removes garbage
73
+
// collected weak references to native Android objects that it manages in order to
74
+
// account for the increased memory usage that comes from analyzing images with an
Copy file name to clipboardExpand all lines: packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/InstanceManager.java
+35-6Lines changed: 35 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -36,9 +36,25 @@ public class InstanceManager {
36
36
// Host uses identifiers >= 2^16 and Dart is expected to use values n where,
0 commit comments