Nothing Special   »   [go: up one dir, main page]

skip to main content
10.5555/2818754.2818812acmconferencesArticle/Chapter ViewAbstractPublication PagesicseConference Proceedingsconference-collections
research-article

Safe memory-leak fixing for C programs

Published: 16 May 2015 Publication History

Abstract

Automatic bug fixing has become a promising direction for reducing manual effort in debugging. However, general approaches to automatic bug fixing may face some fundamental difficulties. In this paper, we argue that automatic fixing of specific types of bugs can be a useful complement.
This paper reports our first attempt towards automatically fixing memory leaks in C programs. Our approach generates only safe fixes, which are guaranteed not to interrupt normal execution of the program. To design such an approach, we have to deal with several challenging problems such as inter-procedural leaks, global variables, loops, and leaks from multiple allocations. We propose solutions to all the problems and integrate the solutions into a coherent approach.
We implemented our inter-procedural memory leak fixing into a tool named LeakFix and evaluated LeakFix on 15 programs with 522k lines of code. Our evaluation shows that LeakFix is able to successfully fix a substantial number of memory leaks, and LeakFix is scalable for large applications.

References

[1]
Y. Wei, Y. Pei, C. A. Furia, L. S. Silva, S. Buchholz, B. Meyer, and A. Zeller, "Automated fixing of programs with contracts," in ISSTA 2010, 2010, pp. 61--72.
[2]
A. Arcuri and X. Yao, "A novel co-evolutionary approach to automatic software bug fixing," in IEEE Congress on Evolutionary Computation. IEEE, 2008, pp. 162--168.
[3]
W. Weimer, T. Nguyen, C. Le Goues, and S. Forrest, "Automatically finding patches using genetic programming," in ICSE '09, 2009, pp. 364--374.
[4]
Y. Qi, X. Mao, Y. Wen, Z. Dai, and B. Gu, "More efficient automatic repair of large-scale programs using weak recompilation," Science China Information Sciences, vol. 55, no. 12, pp. 2785--2799, 2012.
[5]
Y. Xiong, H. Zhang, A. Hubaux, S. She, J. Wang, and K. Czarnecki, "Range fixes: Interactive error resolution for software configuration," Software Engineering, IEEE Transactions on, vol. PP, no. 99, pp. 1--1, 2014.
[6]
Y. Xiong, Z. Hu, H. Zhao, H. Song, M. Takeichi, and H. Mei, "Supporting automatic model inconsistency fixing," in ESEC/FSE, 2009, pp. 315--324.
[7]
D. L. Heine and M. S. Lam, "A practical flow-sensitive and context-sensitive c and c++ memory leak detector," in PLDI '03, 2003, pp. 168--181.
[8]
Y. Xie and A. Aiken, "Context- and path-sensitive memory leak detection," in ESEC/FSE-13, 2005, pp. 115--125.
[9]
S. Cherem, L. Princehouse, and R. Rugina, "Practical memory leak detection using guarded value-flow analysis," in PLDI '07, 2007, pp. 480--491.
[10]
Y. Jung and K. Yi, "Practical memory leak detector based on parameterized procedural summaries," in ISMM '08, 2008, pp. 131--140.
[11]
E. Torlak and S. Chandra, "Effective interprocedural resource leak detection," in ICSE '10, 2010, pp. 535--544.
[12]
Y. Sui, D. Ye, and J. Xue, "Static memory leak detection using full-sparse value-flow analysis," in ISSTA 2012, 2012, pp. 254--264.
[13]
J. Wang, X.-D. Ma, W. Dong, H.-F. Xu, and W.-W. Liu, "Demand-driven memory leak detection based on flow- and context-sensitive pointer analysis," Journal of Computer Science and Technology, vol. 24, no. 2, pp. 347--356, 2009.
[14]
J. Clause and A. Orso, "Leakpoint: pinpointing the causes of memory leaks," in ICSE, 2010, pp. 515--524.
[15]
G. Xu, M. D. Bond, F. Qin, and A. Rountev, "Leakchaser: helping programmers narrow down causes of memory leaks," in PLDI '11, 2011, pp. 270--282.
[16]
C. Lattner, A. Lenharth, and V. Adve, "Making context-sensitive points-to analysis with heap cloning practical for the real world," in PLDI, 2007, pp. 278--289.
[17]
L. Li, C. Cifuentes, and N. Keynes, "Boosting the performance of flow-sensitive points-to analysis using value flow," in ESEC/FSE '11, 2011, pp. 343--353.
[18]
B. Hardekopf and C. Lin, "Semi-sparse flow-sensitive pointer analysis," in POPL '09, 2009, pp. 226--238.
[19]
B. Hardekopf and C. Lin, "Flow-sensitive pointer analysis for millions of lines of code," in CGO '11, 2011, pp. 289--298.
[20]
R. Cytron, J. Ferrante, B. K. Rosen, M. N. Wegman, and F. K. Zadeck, "An efficient method of computing static single assignment form," in Proceedings of the 16th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, ser. POPL '89. New York, NY, USA: ACM, 1989, pp. 25--35.
[21]
X. Zhang, R. Mangal, R. Grigore, M. Naik, and H. Yang, "On abstraction refinement for program analyses in datalog," in Proceedings of the 35th ACM SIGPLAN Conference on Programming Language Design and Implementation, ser. PLDI '14. New York, NY, USA: ACM, 2014, pp. 239--248.
[22]
M. Orlovich and R. Rugina, "Memory leak analysis by contradiction," in SAS'06, 2006, pp. 405--424.
[23]
S. Z. Guyer, K. S. McKinley, and D. Frampton, "Freeme: a static analysis for automatic individual object reclamation," in PLDI '06, 2006, pp. 364--375.
[24]
J. B. Kam and J. D. Ullman, "Monotone data flow analysis frameworks," Acta Informatica, vol. 7, no. 3, pp. 305--317, 1977.
[25]
H. Tang, X. Wang, L. Zhang, B. Xie, L. Zhang, and H. Mei, "Summary-based context-sensitive data-dependence analysis in presence of callbacks," in Proceedings of the 42Nd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, ser. POPL '15. New York, NY, USA: ACM, 2015, pp. 83--95.
[26]
G. Jin, L. Song, W. Zhang, S. Lu, and B. Liblit, "Automated atomicity-violation fixing," in PLDI '11, 2011, pp. 389--400.
[27]
G. Jin, W. Zhang, D. Deng, B. Liblit, and S. Lu, "Automated concurrency-bug fixing," in OSDI'12, 2012, pp. 221--236.
[28]
Z. Gu, E. T. Barr, D. J. Hamilton, and Z. Su, "Has the bug really been fixed?" in ICSE '10, 2010, pp. 55--64.
[29]
B. Hackett and R. Rugina, "Region-based shape analysis with tracked locations," in POPL '05, 2005, pp. 310--323.
[30]
Z. Xu, J. Zhang, and Z. Xu, "Melton: a practical and precise memory leak detection tool for c programs," Front. Comput. Sci., vol. 9(1), pp. 34--54, 2015.
[31]
S. Cherem and R. Rugina, "Uniqueness inference for compile-time object deallocation," in ISMM '07, 2007, pp. 117--128.
[32]
S. Cherem and R. Rugina, "Compile-time deallocation of individual objects," in ISMM '06, 2006, pp. 138--149.
[33]
I. Dillig, T. Dillig, E. Yahav, and S. Chandra, "The closer: Automating resource management in java," in Proceedings of the 7th International Symposium on Memory Management, ser. ISMM '08, 2008, pp. 1--10.
[34]
K. Nguyen, K. Wang, Y. Bu, L. Fang, J. Hu, and G. Xu, "Facade: A compiler and runtime for (almost) object-bounded big data applications," in Proceedings of the 20th International Conference on Architectural Support for Programming Languages and Operating Systems, ser. ASPLOS '15, 2015.
[35]
R. Jones and R. Lins, Garbage collection: algorithms for automatic dynamic memory management. New York, NY, USA: John Wiley & Sons, Inc., 1996.
[36]
H.-J. Boehm and M. Weiser, "Garbage collection in an uncooperative environment," Software: Practice and Experience, vol. 18, no. 9, pp. 807--820, 1988.
[37]
P. Wilson, "Uniprocessor garbage collection techniques," in Memory Management. Springer Berlin Heidelberg, 1992, vol. 637, pp. 1--42.
[38]
H.-J. Boehm, "Bounding space usage of conservative garbage collectors," in POPL '02, 2002, pp. 93--100.
[39]
M. D. Bond and K. S. McKinley, "Bell: bit-encoding online memory leak detection," in ASPLOS-XII, 2006, pp. 61--72.
[40]
W. DePauw and G. Sevitsky, "Visualizing reference patterns for solving memory leaks in java," in ECOOP '99, 1999, pp. 116--134.
[41]
M. Hauswirth and T. M. Chilimbi, "Low-overhead memory leak detection using adaptive statistical profiling," in ASPLOS-XI, 2004, pp. 156--164.
[42]
M. Jump and K. S. McKinley, "Cork: dynamic memory leak detection for garbage-collected languages," in POPL '07, 2007, pp. 31--38.
[43]
W. DePauw, D. Lorenz, J. Vlissides, and M. Wegman, "Execution patterns in object-oriented visualization," in COOTS'98, 1998, pp. 16--16.
[44]
G. Xu and A. Rountev, "Precise memory leak detection for java software using container profiling," in ICSE '08, 2008, pp. 151--160.
[45]
N. Mitchell and G. Sevitsky, "Leakbot: An automated and lightweight tool for diagnosing memory leaks in large java applications," in ECOOP 2003 C Object-Oriented Programming, ser. Lecture Notes in Computer Science, L. Cardelli, Ed. Springer Berlin Heidelberg, 2003, vol. 2743, pp. 351--377.
[46]
G. Novark, E. D. Berger, and B. G. Zorn, "Exterminator: Automatically correcting memory errors with high probability," Commun. ACM, vol. 51, no. 12, pp. 87--95, Dec. 2008.
[47]
H. H. Nguyen and M. Rinard, "Detecting and eliminating memory leaks using cyclic memory allocation," in Proceedings of the 6th International Symposium on Memory Management, ser. ISMM '07. New York, NY, USA: ACM, 2007, pp. 15--30.
[48]
D. Rayside and L. Mendel, "Object ownership profiling: a technique for finding and fixing memory leaks," in ASE, 2007, pp. 194--203.

Cited By

View all

Recommendations

Comments

Please enable JavaScript to view thecomments powered by Disqus.

Information & Contributors

Information

Published In

cover image ACM Conferences
ICSE '15: Proceedings of the 37th International Conference on Software Engineering - Volume 1
May 2015
999 pages
ISBN:9781479919345

Sponsors

Publisher

IEEE Press

Publication History

Published: 16 May 2015

Check for updates

Qualifiers

  • Research-article

Conference

ICSE '15
Sponsor:

Acceptance Rates

Overall Acceptance Rate 276 of 1,856 submissions, 15%

Upcoming Conference

ICSE 2025

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)56
  • Downloads (Last 6 weeks)2
Reflects downloads up to 14 Nov 2024

Other Metrics

Citations

Cited By

View all
  • (2023) Katana: Dual Slicing Based Context for Learning Bug FixesACM Transactions on Software Engineering and Methodology10.1145/357964032:4(1-27)Online publication date: 27-May-2023
  • (2021)If It's Not Secure, It Should Not CompileProceedings of the 43rd International Conference on Software Engineering10.1109/ICSE43902.2021.00123(1360-1372)Online publication date: 22-May-2021
  • (2019)Automatic Software RepairIEEE Transactions on Software Engineering10.1109/TSE.2017.275501345:1(34-67)Online publication date: 1-Jan-2019
  • (2019)VFixProceedings of the 41st International Conference on Software Engineering10.1109/ICSE.2019.00063(512-523)Online publication date: 25-May-2019
  • (2019)Alleviating patch overfitting with automatic test generationEmpirical Software Engineering10.1007/s10664-018-9619-424:1(33-67)Online publication date: 1-Feb-2019
  • (2018)Precise and scalable points-to analysis via data-driven context tunnelingProceedings of the ACM on Programming Languages10.1145/32765102:OOPSLA(1-29)Online publication date: 24-Oct-2018
  • (2018)MemFix: static analysis-based repair of memory deallocation errors for CProceedings of the 2018 26th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering10.1145/3236024.3236079(95-106)Online publication date: 26-Oct-2018
  • (2018)Identifying patch correctness in test-based program repairProceedings of the 40th International Conference on Software Engineering10.1145/3180155.3180182(789-799)Online publication date: 27-May-2018
  • (2018)Automatic Software RepairACM Computing Surveys10.1145/310590651:1(1-24)Online publication date: 23-Jan-2018
  • (2017)Towards API-specific automatic program repairProceedings of the 32nd IEEE/ACM International Conference on Automated Software Engineering10.5555/3155562.3155697(1010-1013)Online publication date: 30-Oct-2017
  • Show More Cited By

View Options

Get Access

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media