Bug Description
OOM when ANRTracker is trying to collect stack trace.
Exception java.lang.OutOfMemoryError:
at java.util.Arrays.copyOf (Arrays.java:3257)
at java.lang.AbstractStringBuilder.ensureCapacityInternal (AbstractStringBuilder.java:124)
at java.lang.AbstractStringBuilder.append (AbstractStringBuilder.java:448)
at java.lang.StringBuilder.append (StringBuilder.java:137)
at com.grafana.faro.ANRTracker.handleAnrDetected (ANRTracker.java:178)
at com.grafana.faro.ANRTracker.run (ANRTracker.java:113)
Reference: https://github.com/grafana/faro-flutter-sdk/blob/main/android/src/main/java/com/grafana/faro/ANRTracker.java#L178
Steps to Reproduce
Hard to reproduce. This problem is crashing our app (infrequently). I assume because on some low-end devices, the ANR happens, the memory is low, and the stack trace is too big (Reference: https://github.com/grafana/faro-flutter-sdk/blob/main/android/src/main/java/com/grafana/faro/ANRTracker.java#L173)
Expected Behavior
The number of stack traces sent (built into the String) is limited (or configurable).
Actual Behavior
All stack traces in the main thread are dumped.
Environment
- Flutter version: 3.16.0
- Dart version: 3.2.0
- Faro Flutter SDK version: 0.3.4
- Platform: Android
- Device: Infinix Infinix-X657B, Redmi dandelion
- OS Version: Android 10, Android 11
Code Sample
No special code.
Additional Context
Checklist
Bug Description
OOM when ANRTracker is trying to collect stack trace.
Reference: https://github.com/grafana/faro-flutter-sdk/blob/main/android/src/main/java/com/grafana/faro/ANRTracker.java#L178
Steps to Reproduce
Hard to reproduce. This problem is crashing our app (infrequently). I assume because on some low-end devices, the ANR happens, the memory is low, and the stack trace is too big (Reference: https://github.com/grafana/faro-flutter-sdk/blob/main/android/src/main/java/com/grafana/faro/ANRTracker.java#L173)
Expected Behavior
The number of stack traces sent (built into the String) is limited (or configurable).
Actual Behavior
All stack traces in the main thread are dumped.
Environment
Code Sample
No special code.
Additional Context
Checklist