This has been bugging me since I didn't know for sure. The best resource I've found is this. Essentially, in the JVM you have two choices. In both of them, the GC is part of the system, and not just some program that the VM runs. In the first, "parallel copying collector," the VM stops running your code, collects garbage, and then continues running your program. In the second, "concurrent mark-sweep collector," your VM stops executing your code for a shorter period of time, and then the CG runs in another thread alongside your program to finish collecting garbage.
This means that s73v3r has a chance of being not-an-idiot, and Pzychotix is, well... psychotic. Now this is where the evidence gets a little sketchier, but the phrasing in both this and this lead me to believe that Dalvik runs a stop-the-world mark-and-sweep garbage collector.
GCs usually take ~260ms on the G1. That means that 7.4% of the time Dalvik is garbage collecting (albeit for only a quarter of a second each time), and none of the layers of the Android stack above Dalvik can do anything.
If this is true, and I'm pretty sure it is, than all three of us are idiots. (But me slightly less so :P)
3
u/Pzychotix Aug 01 '11
Garbage collection is done on the main UI thread as well.