Abstract:
Each Android application (app) runs in its own virtual machine (VM), with every VM allocated
a limited heap size for creating new objects. The heap size is scarce and device dependent. The
more heap space an app uses, the more work the garbage collector (GC) would have; the more
work the GC has, the bigger is the pause time for collection of un-referenced objects. To avoid
frequent garbage collection, the objects should be allocated wisely. In this work, we propose
a tool called SOS to help the developers to control and reuse memory allocated to objects on
the heap. In this work, we target objects allocated in loops and identify them by leveraging
static program analysis techniques. With the intention to reuse the heap space allocated to these
objects, we further perform program transformation. As a case study, we take Android apps and
manifest the benefits that SOS can provide in terms of reduction in pause times and reduction in
heap space used. We show the trends in pause times, number of GC invocations and heap space
freed, as a function of number of temporary objects.