Platform: Android (Google Pixel XL Android 7.0.0)
Mapbox SDK version: 5.2.0-beta.5
Only seems to be happening on the beta version
The issue seems to be coming from the mapview's onDestroy call and after stepping through the code, it attempts to call nativeMapView.destroy(); and stops there.
I also noticed that when I comment out the mapView.onDestroy() in my activity, the UI no longer freezes but I assume this call necessary to avoid potential memory leaks. How would I go about resolving this issue?
1607-1621/system_process E/ActivityManager: ANR in *package name here* (*Activity name here*)
PID: 6573
Reason: Input dispatching timed out (Waiting to send non-key event because the touched window has not finished processing certain input events that were delivered to it over 500.0ms ago. Wait queue length: 28. Wait queue head age: 1104232.6ms.)
Load: 0.0 / 0.01 / 0.05
CPU usage from 8068ms to 0ms ago (2017-11-17 12:58:45.809 to 2017-11-17 12:58:53.878):
6% 1607/system_server: 1.9% user + 4% kernel / faults: 1857 minor 1 major
2.6% 1304/surfaceflinger: 0.2% user + 2.3% kernel
1.9% 1363/audioserver: 0% user + 1.9% kernel / faults: 1 minor
0.4% 6573/com.pioneer.encirca.android.dev.debug: 0.4% user + 0% kernel / faults: 306 minor
0.3% 1823/com.android.phone: 0.3% user + 0% kernel / faults: 183 minor
0.2% 1690/com.android.systemui: 0% user + 0.2% kernel / faults: 218 minor
0% 1250/logd: 0% user + 0% kernel
0.1% 1310/adbd: 0% user + 0.1% kernel / faults: 72 minor
0% 1371/mediaserver: 0% user + 0% kernel / faults: 17 minor
0.1% 2044/com.google.android.gms.persistent: 0.1% user + 0% kernel / faults: 1 minor
0.1% 2260/com.google.android.gms: 0.1% user + 0% kernel / faults: 7 minor
0.1% 5845/kworker/0:2: 0% user + 0.1% kernel
0% 6528/kworker/u5:0: 0% user + 0% kernel
0% 6782/kworker/u5:1: 0% user + 0% kernel
3.6% TOTAL: 1.4% user + 2.1% kernel
CPU usage from 203ms to 707ms later (2017-11-17 12:58:54.080 to 2017-11-17 12:58:54.584):
0% TOTAL: 0% user + 0% kernel
Map's onDestroy method is called successfully, and UI does not freeze
UI freezes and becomes unresponsive
@aoben10 I'm seeing you closed this issue, I haven't been able to look into yet, where you able to resolve it on your own? Was it related to https://github.com/mapbox/mapbox-gl-native/pull/10501? Thank you for reaching out and providing feedback!
Yes, it was. I wasn't calling the right life cycle callback method in my fragment. Thanks for asking 馃槃
Which life cycle method fixed this for you? @aoben10
@jethro-yard8 Mapview#OnDestroy should be called from Fragment#OnDestroyView
Yep, just like what @tobrun said, calling from Fragment#OnDestroyView is what fixed the issue for me
Okay but what if i'm using an Activity? I'm not using any fragments in my project
I have the same problem with Activity.
@Override
protected void onDestroy() {
super.onDestroy();
mapView.onDestroy();
}
Takes 2400 milliseconds. Not every time.
Could you provide any suggestions to fix that?
Thanks
the only use-case where I can see a freeze occurring is if the MapView has been removed before MapView#onDestroy() has been called. Happy to look more into this if you can provide minimal reproducible example code.
Most helpful comment
@jethro-yard8 Mapview#OnDestroy should be called from Fragment#OnDestroyView