Detecting Memory Leaks Statically with Full-Sparse Value-Flow Analysis

Yulei Sui, Ding Ye, Jingling Xue
2014 IEEE Transactions on Software Engineering  
We introduce a static detector, SABER, for detecting memory leaks in C programs. Leveraging recent advances on sparse pointer analysis, SABER is the first to use a full-sparse value-flow analysis for detecting memory leaks statically. SABER tracks the flow of values from allocation to free sites using a sparse value-flow graph (SVFG) that captures def-use chains and value flows via assignments for all memory locations represented by both top-level and address-taken pointers. By exploiting
more » ... , flow-and contextsensitivity during different phases of the analysis, SABER detects memory leaks in a program by solving a graph reachability problem on its SVFG. SABER, which is fully implemented in Open64, is effective at detecting 254 leaks in the 15 SPEC2000 C programs and seven applications, while keeping the false positive rate at 18.3 percent. SABER compares favorably with several static leak detectors in terms of accuracy (leaks and false alarms reported) and scalability (LOC analyzed per second). In particular, compared with FASTCHECK (which analyzes allocated objects flowing only into top-level pointers) using the 15 SPEC2000 C programs, SABER detects 44.1 percent more leaks at a slightly higher false positive rate but is only a few times slower.
doi:10.1109/tse.2014.2302311 fatcat:itnbg4tzr5ew5eepvdymldgqj4