Virtual Machine-Assisted Collaborative Junk Object Detection
Memory leak is an unrecoverable software bug that causes performance degradation and reliability issues to software applications. Although memory management system exists in modern Object Oriented Language to reclaim unused memory store, memory leak can still happen, and continue to exhaust memory resource. In Java, where there is garbage collection for releasing unused objects, memory leak manifest itself in the form of unused object retention. Since Java Programming language allocates objects on heap, the lifetime of an object deviate from the stack discipline, which can be a challenge in detecting Java memory leak. In this thesis, we propose an collaborative approach in detecting Java program memory leak through verifying Object Lifetime Specification at runtime. We designed a runtime verifier that leverages on Java Virtual Machine technologies to monitor, extract annotated information from the user application, and use that information to verify against Java Virtual Machine events to detect unintentional object retention in the Java application under test.
We implemented our runtime verifier with Maxine Virtual Machine, an open source, meta-circular virtual machine developed by Oracle Lab, and conducted experiments and DaCapo benchmark evaluate its accuracy and performance efficiency. The results shows that the runtime verification tool successfully identifies junk objects for different semantic cases proposed in this thesis with certain runtime overhead. Through the research and experimental results, we further make implications on how to improve the performance overhead associated with current design and implementation methods in detecting unused object retention, which in the long term constitute memory leak and performance bug.