Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - Suspending all threads took: * ms

I'm having these warnings in my logcat even after a while that i left the application. (Didn't kill though, just pressed back to leave it.)

05-03 13:43:42.955 13047-13053/package W/art: Suspending all threads took: 7.873ms
05-03 13:44:32.458 13047-13053/package W/art: Suspending all threads took: 13.441ms
05-03 13:46:58.584 13047-13053/package W/art: Suspending all threads took: 34.462ms
05-03 13:47:00.574 13047-13053/package W/art: Suspending all threads took: 8.281ms
05-03 13:48:00.425 13047-13053/package W/art: Suspending all threads took: 25.929ms
05-03 13:48:16.019 13047-13053/package W/art: Suspending all threads took: 35.053ms
05-03 13:50:01.858 13047-13053/package W/art: Suspending all threads took: 16.160ms
05-03 13:50:17.975 13047-13053/package W/art: Suspending all threads took: 20.074ms
05-03 13:52:07.744 13047-13053/package W/art: Suspending all threads took: 19.814ms
05-03 13:53:17.668 13047-13053/package W/art: Suspending all threads took: 7.578ms
05-03 13:54:42.766 13047-13053/package W/art: Suspending all threads took: 11.316ms
05-03 13:56:19.314 13047-13053/package W/art: Suspending all threads took: 21.873ms
05-03 13:58:56.140 13047-13053/package W/art: Suspending all threads took: 7.860ms
05-03 14:00:12.084 13047-13053/package W/art: Suspending all threads took: 19.430ms

Those numbers are serious and a lot.

I saw some questions about this issue, and none of them was similar to mine and i cannot accept that "ignore it unless you don't have OOM or freezing issue" if that may cause, i cannot wait until it happens to do something about it.

I just need to know what causes this and how can i prevent this.

I use Retrofit to get my webservice request done. And a ThreadPoolExecutor to get/update/delete data from cache while waiting for request completed. I do not think any of these causing this though.

Any ideas or general informations about this situation are appreciated, because i find nothing specific on this "suspending all threads" warning.

like image 428
yahya Avatar asked May 03 '16 11:05

yahya


1 Answers

Looks like there's some thread running in your process, allocating temporary objects, which ART has to garbage collect and suspends all threads to do that.

Try tracing what could still be running in the background even after you leave the app. You can also try using the "Allocation tracker" in Android Studio to find what object are being allocated - maybe that will put you on track the stray thread.

like image 121
Marcin Koziński Avatar answered Nov 15 '22 16:11

Marcin Koziński