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.
翻译:资源渗漏 -- 一个程序不会释放它以前获得的资源 -- 是安氏剂应用中常见的一种错误。 即便在自动检测泄漏的现有技术的帮助下, 写出一个无漏程序仍然很棘手。 原因之一是安氏剂的事件驱动编程模型, 这使人们对应用程序总体控制流程的理解复杂化。 在本文中, 我们介绍 PlubDroid: 自动检测和修复安氏剂应用中的资源渗漏的技术。 PlubDroid 使用静态分析来寻找执行漏洞, 这可能泄漏资源。 用于检测的底栖动物也自动建立一个修复系统 -- -- 包括适当地点进行的释放操作 -- -- 这些信息可以消除泄漏, 并且不会影响应用程序对资源使用情况的使用。 对来自DroidLeaks 曲线收集的资源渗漏的实证评估表明, PlubdD 的方法是可变缩缩缩缩缩的, 并且为各种资源漏漏漏漏的精确方法: 发现并修复50个渗漏, 影响到安氏剂系统9个广泛使用的资源, 包括适当地点进行的释放操作 -- 清除作业, 也显示所有由Droidleak Leak 流收集的精度 的精度, 的精度, 也能 提升到更精确到更精度。