Dynamic Java Program Analysis Using Virtual Machine Modification
At the present time automatic static and dynamic program analysis methods are extensively used during software development. Dynamic methods in particular allow cost-efficient detection of various runtime issues with minimal expert interaction, thus saving time and resources. Dynamic analysis methods for native applications employ external monitoring instruments and code modification in order to evaluate execution, while programs running under control of an interpreter or a virtual machine it offers a balanced observation layer – the interpreter or virtual machine itself. In this paper we focus on automatic memory profiling methods for Java applications running on Dalvik virtual machine – a part of rapidly growing Android operating system.
Current Dalvik VM limitations make it impossible to use complex Java profilers designed for desktop applications; Dalvik-compatible profiling tools provide insufficient data to perform deep memory usage analysis. In this paper we describe a set of extensions for Dalvik implementation of standard Java Debug Wire Protocol which allow tracking of in-depth program memory events: object allocation, garbage collection, memory read and write access. We present a debugger-level tool based on existing Dalvik Debug Monitor utility, that is compatible with the extended Dalvik VM and allows online tracking of aforementioned events along with base debugging features and gprof memory dump support. As the original DDM utility, our design supports concurrent tracking of multiple applications to identify memory usage issues related to interprocess communication.
We have used the developed system to analyze a set of standard Android applications identifying several memory usage trends, including prevalence of primitive array allocations and inefficient use of memory among standard Android GUI Java classes.
Proceedings of the Institute for System Programming, vol. 27, issue 2, 2015, pp. 23-38.
ISSN 2220-6426 (Online), ISSN 2079-8156 (Print).
DOI: 10.15514/ISPRAS-2015-27(2)-2Full text of the paper in pdf (in Russian) Back to the contents of the volume