Advertisement

Memory Leak Analysis by Contradiction

  • Maksim Orlovich
  • Radu Rugina
Part of the Lecture Notes in Computer Science book series (LNCS, volume 4134)

Abstract

We present a novel leak detection algorithm. To prove the absence of a memory leak, the algorithm assumes its presence and runs a backward heap analysis to disprove this assumption. We have implemented this approach in a memory leak analysis tool and used it to analyze several routines that manipulate linked lists and trees. Because of the reverse nature of the algorithm, the analysis can locally reason about the absence of memory leaks. We have also used the tool as a scalable, but unsound leak detector for C programs. The tool has found several bugs in larger programs from the SPEC2000 suite.

Keywords

Leak Detection Program Point Error Cell Memory Leak Heap Structure 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Dor, N., Rodeh, M., Sagiv, M.: Checking cleanness in linked lists. In: Proceedings of the 8th International Static Analysis Symposium, Santa Barbara, CA (2000)Google Scholar
  2. 2.
    Shaham, R., Kolodner, E.K., Sagiv, M.: Automatic removal of array memory leaks in java. In: Watt, D.A. (ed.) CC 2000. LNCS, vol. 1781, p. 50. Springer, Heidelberg (2000)CrossRefGoogle Scholar
  3. 3.
    Heine, D., Lam, M.: A practical flow-sensitive and context-sensitive C and C++ memory leak detector. In: Proceedings of the SIGPLAN 2003 Conference on Program Language Design and Implementation, San Diego, CA (2003)Google Scholar
  4. 4.
    Hackett, B., Rugina, R.: Shape analysis with tracked locations. In: Proceedings of the 32nd Annual ACM Symposium on the Principles of Programming Languages, Long Beach, CA (2005)Google Scholar
  5. 5.
    Xie, Y., Aiken, A.: Context- and path-sensitive memory leak detection. In: ACM SIGSOFT Symposium on the Foundations of Software Engineering, Lisbon, Portugal (2005)Google Scholar
  6. 6.
    Heine, D., Lam, M.: A practical flow-sensitive and context-sensitive C and C++ memory leak detector. In: Proceedings of PLDI, San Diego, CA (2003)Google Scholar
  7. 7.
    Sagiv, M., Reps, T., Wilhelm, R.: Parametric shape analysis via 3-valued logic. ACM Transactions on Programming Languages and Systems 24(3) (2002)Google Scholar
  8. 8.
    Steensgaard, B.: Points-to analysis in almost linear time. In: Proceedings of the 23rd Annual ACM Symposium on the Principles of Programming Languages, St. Petersburg Beach, FL (1996)Google Scholar
  9. 9.
    Andersen, L.O.: Program Analysis and Specialization for the C Programming Language. PhD thesis, DIKU, University of Copenhagen (1994)Google Scholar
  10. 10.
    Sharir, M., Pnueli, A.: Two approaches to interprocedural data flow analysis. In: Muchnick, S., Jones, N. (eds.) Program Flow Analysis: Theory and Applications, Prentice Hall Inc., Englewood Cliffs (1981)Google Scholar
  11. 11.
    Orlovich, M., Rugina, R.: Memory leak analysis by contradiction. Technical report, Cornell University (2006)Google Scholar
  12. 12.
    Rinetzky, N., Sagiv, M.: Interprocedural shape analysis for recursive programs. In: Wilhelm, R. (ed.) CC 2001. LNCS, vol. 2027, p. 133. Springer, Heidelberg (2001)CrossRefGoogle Scholar
  13. 13.
    Manevich, R., Sridharan, M., Adams, S., Das, M., Yang, Z.: PSE: Explaining program failures via postmortem static analysis. In: Proceedings of the ACM SIGSOFT 1999 Symposium on the Foundations of Software Engineering, Newport Beach, CA (2002)Google Scholar
  14. 14.
    Strom, R., Yellin, D.: Extending typestate checking using conditional liveness analysis. IEEE Transactions on Software Engineering 19(5), 478–485 (1993)CrossRefGoogle Scholar
  15. 15.
    Duesterwald, E., Gupta, R., Soffa, M.: Demand-driven computation of interprocedural data flow. In: Proceedings of the 22nd Annual ACM Symposium on the Principles of Programming Languages, San Francisco, CA (1995)Google Scholar
  16. 16.
    Horwitz, S., Reps, T., Sagiv, M.: Demand interprocedural dataflow analysis. In: Proceedings of the ACM Symposium on the Foundations of Software Engineering, Washington, DC (1995)Google Scholar
  17. 17.
    Sagiv, S., Reps, T., Horwitz, S.: Precise interprocedural dataflow analysis with applications to constant propagation. Theoretical Computer Science 167(1&2), 131–170 (1996)CrossRefMathSciNetMATHGoogle Scholar
  18. 18.
    Ghiya, R., Hendren, L.: Is is a tree, a DAG or a cyclic graph? a shape analysis for heap-directed pointers in C. In: Proceedings of the 23rd Annual ACM Symposium on the Principles of Programming Languages, St. Petersburg Beach, FL (1996)Google Scholar
  19. 19.
    Hastings, R., Joyce, B.: Purify: Fast detection of memory leaks and access errors. In: Proceedings of the 1992 Winter Usenix Conference (1992)Google Scholar
  20. 20.
    Hauswirth, M., Chilimbi, T.: Low-overhead memory leak detection using adaptive statistical profiling. In: Proceedings of the 11th International Conference on Architectural Support for Programming Languages and Operating Systems, Boston, MA (2004)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2006

Authors and Affiliations

  • Maksim Orlovich
    • 1
  • Radu Rugina
    • 1
  1. 1.Computer Science DepartmentCornell UniversityIthaca

Personalised recommendations