I'm having a few OutOfMemory errors on long running sessions of my Android App. To find the cause I'm trying to use the Android Studio Profiler but it stops working and freezes the app within 10 seconds of use.
There's a screenshot of the Android Studio Screen. It logs the activities within the first seconds, then it just freezes the app and stops logging anything -> https://ibb.co/QXLhqnz
Last lines of my logcat reads (the last lines keep repeating with increasing time, I changed my package name)
2019-04-09 08:42:41.151 19728-20399/br.com.xxxxx V/StudioProfiler: Live memory tracking enabled.
2019-04-09 08:42:41.151 19728-20399/br.com.xxxxx V/StudioProfiler: JNIEnv not attached
2019-04-09 08:42:41.483 19728-20399/br.com.xxxxx V/StudioProfiler: Loaded classes: 8894
2019-04-09 08:42:51.688 19728-20399/br.com.xxxxx E/zygote: E[0]:Timed out waiting for threads to suspend(br.com.xxxxx), waited for 10.000s
2019-04-09 08:43:01.689 19728-20399/br.com.xxxxx E/zygote: E[0]:Timed out waiting for threads to suspend(br.com.xxxxx), waited for 20.000s
2019-04-09 08:43:11.689 19728-20399/br.com.xxxxx E/zygote: E[0]:Timed out waiting for threads to suspend(br.com.xxxxx), waited for 30.000s
Any help appreciated thanks in advance.
Many times a simple clean boot has solved the app not responding issue for me. A clean boot ensures no startup app or service is conflicting with the not responding app. To clean boot Windows 10, press Windows + R keys and type msconfig in the Run dialog to open the System Configuration window.
Another reason for Apps to stop working could be corrupted Cache files, which have not been cleared in a long time. Many users also feel that incomplete or improper installation may cause the App to crash and stop working suddenly.
Many users also feel that incomplete or improper installation may cause the App to crash and stop working suddenly. There may be many more reasons for them; unfortunately, App has stopped error to show up, but no one reason can be blamed for it.
Then redownload the app. Then check to see if the problem with the app is fixed. If the App Store itself is not responding, contact Apple Support for your iPhone or for your iPad. If you found the app on the App Store, contact the app developer.
The Android Studio Profiler might not be the proper tool for the task. First identify possible memory leaks with LeakCanary and fix them, then you should be able to use the Profiler, without having stalled/killed threads. Without the least code provided, this might be the best possible answer.
The reason for this behavior likely is, that the ART kills off stalled threads, while the Profiler keeps waiting for them to respond, which obviously will never happen, because they don't exist anymore.
The error message comes from ART, just see thread_list.cc
. On Dalvik VM it might behave differently (most likely force-close due to OOM, or it may crash the VM). That might be worth a try. Stepping into it while profiling might also be an option, but it's by far not as handy as LeakCanaray.
Update: The Android Studio 3.6.2 release notes state:
Improved memory leak detection for your Activities and Fragments when using Profilers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With