论文标题
自动修复Android应用中资源泄漏
Automated Repair of Resource Leaks in Android Applications
论文作者
论文摘要
资源泄漏 - 程序没有发布以前获取的资源 - 是Android应用程序中常见的错误。即使借助现有技术来自动检测泄漏,编写无泄漏程序仍然很棘手。原因之一是Android的事件驱动的编程模型,这使人们对应用程序的整体控制流程的理解变得复杂。 在本文中,我们介绍了Plumbdroid:一种自动检测和修复Android应用中资源泄漏的技术。 PlumbDroid使用静态分析来查找可能泄漏资源的执行跟踪。用于检测的信息还自动建立了一个修复程序(包括在适当位置执行的释放操作)的修复程序,该修复程序可以消除泄漏,否则不会影响应用程序对资源的使用情况。 对来自Droidleaks策划的资源泄漏的经验评估表明,PlumbDroid的方法是可扩展的,准确的,并且为各种资源泄漏错误提供了正确的修复:Plumbdroid自动发现并修复了50次泄漏,这些泄漏影响了9个广泛使用的Android System的9种泄漏,包括所有资源收集的所有资源,包括这些资源用于这些资源;平均而言,仅需2分钟即可检测和修复泄漏。 PlumbDroid还可以与Relda2/Relfix进行比较,Relda2/relfix是修复Android资源泄漏的唯一其他全自动方法 - 因为它通常会检测到具有更高精度并产生较小固定的泄漏。这些结果表明,PlumbDroid可以提供有价值的支持,以提高实践中的Android应用的质量。
Resource leaks -- a program does not release resources it previously acquired -- are a common kind of bug in Android applications. Even with the help of existing techniques to automatically detect leaks, writing a leak-free program remains tricky. One of the reasons is Android's event-driven programming model, which complicates the understanding of an application's overall control flow. In this paper, we present PlumbDroid: a technique to automatically detect and fix resource leaks in Android applications. PlumbDroid uses static analysis to find execution traces that may leak a resource. The information built for detection also undergirds automatically building a fix -- consisting of release operations performed at appropriate locations -- that removes the leak and does not otherwise affect the application's usage of the resource. An empirical evaluation on resource leaks from the DroidLeaks curated collection demonstrates that PlumbDroid's approach is scalable, precise, and produces correct fixes for a variety of resource leak bugs: PlumbDroid automatically found and repaired 50 leaks that affect 9 widely used resources of the Android system, including all those collected by DroidLeaks for those resources; on average, it took just 2 minutes to detect and repair a leak. PlumbDroid also compares favorably to Relda2/RelFix -- the only other fully automated approach to repair Android resource leaks -- since it usually detects more leaks with higher precision and producing smaller fixes. These results indicate that PlumbDroid can provide valuable support to enhance the quality of Android applications in practice.