I'm working on an app that handles a lot of allocations (on the order of 4 million doubles and a million classes). I was looking through garbage collector logs and I'm seeing different amounts of memory total being freed across different devices.
For example, I have a Moto X (2014) that ends up freeing just over 312 MB. I also have a Droid Bionic running the same code on the same data that frees 616 MB on average. Both devices end up with a heap size of about 50 MB.
Why is so much more memory freed by the GC on the Bionic than the Moto X? They should generate the same amount of garbage each. What's going on behind the scenes in the garbage collector? The Moto X is on Android 5.1 and the Bionic is on 4.1.2.
Edit: I have four devices that are freeing about 300 MB RAM: the Moto X (2014), Nexus 7 2013, Nexus 7 2012, and Razr i. All four of these use ART. The Bionic is running the Dalvik runtime. Is this why there's less freeing up? I noticed GC_FOR_ALLOC doesn't happen in ART but is getting called all the time on Dalvik.