Low-Overhead Memory Leak Detection Using Adaptive Statistical Profiling

Low-Overhead Memory Leak Detection Using Adaptive Statistical Profiling
Related tools & artifacts:
Conference Paper: ASPLOS'04, October, 2004

Sampling has been successfully used to identify performance optimization opportunities. We would like to apply similar techniques to check program correctness. Unfortunately, sampling provides poor coverage of infrequently executed code, where bugs often lurk. We describe an adaptive profiling scheme that addresses this by sampling executions of code segments at a rate inversely proportional to their execution frequency. To validate our ideas, we have implemented SWAT, a novel memory leak detection tool. SWAT traces program allocations/ frees to construct a heap model and uses our adaptive profiling infrastructure to monitor loads/stores to these objects with low overhead. SWAT reports 'stale' objects that have not been accessed for a 'long' time as leaks. This allows it to find all leaks that manifest during the current program execution. Since SWAT has low runtime overhead (‹5%), and low space overhead (‹10% in most cases and often less than 5%), it can be used to track leaks in production code that take days to manifest. In addition to identifying the allocations that leak memory, SWAT exposes where the program last accessed the leaked data, which facilitates debugging and fixing the leak. SWAT has been used by several product groups at Microsoft for the past 18 months and has proved effective at detecting leaks with a low false positive rate (‹10%).

@inproceedings{Hauswirth04, author = {Hauswirth, Matthias and Chilimbi, Trishul M.}, title = {Low-overhead memory leak detection using adaptive statistical profiling}, booktitle = {Proceedings of the 11th international conference on Architectural support for programming languages and operating systems}, series = {ASPLOS-XI}, year = {2004}, isbn = {1-58113-804-0}, location = {Boston, MA, USA}, pages = {156--164}, numpages = {9}, url = {http://doi.acm.org/10.1145/1024393.1024412}, doi = {http://doi.acm.org/10.1145/1024393.1024412}, acmid = {1024412}, publisher = {ACM}, address = {New York, NY, USA}, keywords = {low-overhead monitoring, memory leaks, runtime analysis}, }

ACM DL Author-ize service