Abstract:Resource leak is an important software defect that affects the quality and reliability of software and may cause program abnormality or even system crash.Static analysis is an effective defect detection method which can identify potential resource leaks in source code or executable binary.However,as the scale of programs increases,the complexity of accurate resource leak detection rises exponentially,thereby making it difficult to meet the demand of just-in-time defect detection for large practical applications.In this paper,an incremental static resource leak detection algorithm is proposed for large-scale source code projects.The algorithm supports inter-procedural flow sensitive resource leak detection that allows developers to observe the impact of their changes immediately.Starting from the modified functions,this approach narrows down the scope of resource leak detection by generating method closures and performing points-to analysis to analyze hundreds of thousands of lines of source code in seconds.Experimental results show that the algorithm completes defect detection within 10s with a high accuracy on more than 90% of the tests,which makes it possible for just-in-time resource leak detection for practical applications.