what does WAIT_FOR_CONCURRENT_GC blocked mean?

江枫思渺然 提交于 2019-11-29 05:51:45

问题


I just did an automatic update from ICS (4.0.4) to JB (4.1) on my android phone and it introduced multiple garbage collection calls when I run my app:

WAIT_FOR_CONCURRENT_GC blocked 30ms

I'm streaming video in my app and these blocked GC calls are almost doubling my latency, what do they mean?


回答1:


That message is emitted in a couple of cases:

  • when user code explicitly calls gc(), and a gc is already in progress.
  • when code tries to do an allocation but there isn't actually room in memory to accommodate the request, and a gc is already in progress.

In either case, what's happening is that, in order to satisfy the request, the first step is waiting for the hot garbage collecting action that's taking place in another thread. Once that's done, then the thread can move onto what it was more directly asked to do (which might cause further garbage collection).

You can find the salient sources in platform/dalvik/vm/alloc, particularly Heap.cpp and Alloc.cpp.

All that said, I can't tell you why you're seeing more pauses in JB than in ICS.




回答2:


We didn't log this time before JB. Your app's threads have always had to block waiting for any concurrent GC to complete before they can do a collection, but JB is the first release in which you can see when they do, and where you can see how long they have to wait.



来源:https://stackoverflow.com/questions/11531657/what-does-wait-for-concurrent-gc-blocked-mean

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!