skip to main content
research-article

Efficiently and precisely locating memory leaks and bloat

Published:15 June 2009Publication History
Skip Abstract Section

Abstract

Inefficient use of memory, including leaks and bloat, remain a significant challenge for C and C++ developers. Applications with these problems become slower over time as their working set grows and can become unresponsive. At the same time, memory leaks and bloat remain notoriously difficult to debug, and comprise a large number of reported bugs in mature applications. Previous tools for diagnosing memory inefficiencies-based on garbage collection, binary rewriting, or code sampling-impose high overheads (up to 100X) or generate many false alarms.

This paper presents Hound, a runtime system that helps track down the sources of memory leaks and bloat in C and C++ applications. Hound employs data sampling, a staleness-tracking approach based on a novel heap organization, to make it both precise and efficient. Hound has no false positives, and its runtime and space overhead are low enough that it can be used in deployed applications. We demonstrate Hound's efficacy across a suite of synthetic benchmarks and real applications.

References

  1. A. W. Appel and K. Li. Virtual memory primitives for user programs. In Proceedings of the Fourth International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS '91), pages 96--107, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. E. D. Berger, B. G. Zorn, and K. S. McKinley. Reconsidering custom memory allocation. In Proceedings of the 2002 ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA '02), pages 1--12, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. M. D. Bond and K. S. McKinley. Bell: bit-encoding online memory leak detection. In Proceedings of the 12th International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS '06), pages 61--72, San Jose, CA, Oct. 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. M. D. Bond and K. S. McKinley. Tolerating memory leaks. In Proceedings of the 23rd Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA 2008), pages 109--126, Nashville, TN, Oct. 2008. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. S. Cherem, L. Princehouse, and R. Rugina. Practical memory leak detection using guarded value-flow analysis. In Proceedings of the 2007 ACM SIGPLAN Conference on Programming language design and implementation (PLDI '07), pages 480--491, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. D. Dhurjati and V. Adve. Efficiently detecting all dangling pointer uses in production servers. In Proceedings of the International Conference on Dependable Systems and Networks (DSN '06), pages 269--280, Washington, DC, USA, 2006. IEEE Computer Society. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. R. Hastings and B. Joyce. Fast detection of memory leaks and access errors. In Proceedings of the Winter '92 USENIX conference, pages 125--136. USENIX Association, 1992.Google ScholarGoogle Scholar
  8. M. Hauswirth and T. M. Chilimbi. Low-overhead memory leak detection using adaptive statistical profiling. In ASPLOS, pages 156--164, Boston, MA, Apr. 2004. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. D. L. Heine and M. S. Lam. A practical flow-sensitive and context-sensitive C and C++ memory leak detector. In Proceedings of the ACM SIGPLAN 2003 conference on Programming Language Design and Implementation (PLDI '03), pages 168--181, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. R. E. Jones and R. Lins. Garbage Collection: Algorithms for Automatic Dynamic Memory Management. Wiley, Chichester, July 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. M. Jump and K. S. McKinley. Cork: Dynamic memory leak detection for garbage-collected languages. In Proceedings of the 34th annual ACM SIGPLAN-SIGACT symposium on Principles of Programming Languages (POPL '07), pages 31--38, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. P.-H. Kamp. Malloc(3) revisited. http://phk.freebsd.dk/pubs/malloc.pdf. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. C. Lattner and V. Adve. Automatic pool allocation: improving performance by controlling data structure layout in the heap. In PLDI '05: Proceedings of the 2005 ACM SIGPLAN conference on Programming language design and implementation, pages 129--142, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. D. Lea. A memory allocator. http://gee.cs.oswego.edu/dl/html/malloc.html, 1997.Google ScholarGoogle Scholar
  15. C.-K. Luk, R. Cohn, R. Muth, H. Patil, A. Klauser, G. Lowney, S. Wallace, V. J. Reddi, and K. Hazelwood. Pin: building customized program analysis tools with dynamic instrumentation. In Proceedings of the 2005 ACM SIGPLAN conference on Programming language design and implementation (PLDI '05), pages 190--200, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. V. B. Lvin, G. Novark, E. D. Berger, and B. G. Zorn. Archipelago: trading address space for reliability and security. In Proceedings of the 13th International Conference on Architectural Support for Programming Languages and Operating Systems, (ASPLOS '08), pages 115--124, Mar. 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. J. Maebe, M. Ronsse, and K. D. Bosschere. Precise detection of memory leaks. In Workshop on Dynamic Analysis (WODA 04), pages 25--31, 2004.Google ScholarGoogle ScholarCross RefCross Ref
  18. Microsoft TechNet, Microsoft Corporation. Memory Leak Diagnoser, Dec. 2007.Google ScholarGoogle Scholar
  19. N. Mitchell and G. Sevitsky. LeakBot: An automated and lightweight tool for diagnosing memory leaks in large Java applications. In European Conference on Object-Oriented Programming (ECOOP), 2003.Google ScholarGoogle ScholarCross RefCross Ref
  20. Mozilla.org. [email protected], 2008. {Online; accessed 12-March-2008}.Google ScholarGoogle Scholar
  21. N. Nethercote and J. Seward. Valgrind: a framework for heavyweight dynamic binary instrumentation. In Proceedings of the ACM SIGPLAN 2007 Conference on Programming Language Design and Implementation (PLDI '07), pages 89--100, June 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. 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 (ISMM '07), pages 15--30, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. M. Orlovich and R. Rugina. Memory leak analysis by contradiction. In Proceedings of the 13th Annual Static Analysis Symposium (SAS '06), pages 405--424, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. F. Qin, S. Lu, and Y. Zhou. SafeMem: Exploiting ECC-memory for detecting memory leaks and memory corruption during production runs. In Proceedings of the 11th International Symposium on High-Performance Computer Architecture (HPCA '05), volume 00, pages 291--302. IEEE Computer Society, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. D. Rayside and L. Mendel. Object ownership profiling: a technique for finding and fixing memory leaks. In Proceedings of the 22nd IEEE/ACM international conference on Automated software engineering (ASE '07), pages 194--203, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. N. Röjemo and C. Runciman. Lag, drag, void, and use: Heap profiling and space-efficient compilation revisited. In Proceedings of First International Conference on Functional Programming, pages 34--41, Philadelphia, PA, May 1996. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. M. L. Seidl and B. G. Zorn. Segregating heap objects by reference behavior and lifetime. In Proceedings of the Eighth International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS '98), pages 12--23, San Jose, CA, Oct. 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. R. Shaham, E. K. Kolodner, and S. Sagiv. Automatic removal of array memory leaks in Java. In Proceedings of the 9th International Conference on Compiler Construction (CC '00), pages 50--66, London, UK, 2000. Springer. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. R. Shaham, E. Yahav, E. Kolodner, and M. Sagiv. Establishing local temporal heap safety properties with applications to compile-time memory management. In SAS '03: Proceedings of the 10th Annual Static Analysis Symposium, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Standard Performance Evaluation Corporation. SPEC2006. http://www.spec.org.Google ScholarGoogle Scholar
  31. Y. Tang, Q. Gao, and F. Qin. LeakSurvivor: Towards safely tolerating memory leaks for garbage-collected languages. In Proceedings of the 2008 USENIX Annual Technical Conference (USENIX '08), pages 307--320, Boston, MA, June 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. L. Torvalds. Linux kernel mailing list post. http://lkml.org/lkml/2004/1/12/265, 1 2004.Google ScholarGoogle Scholar
  33. T. Tsai, K. Vaidyanathan, and K. C. Gross. Low-overhead run-time memory leak detection and recovery. In Proceedings of the 12th Pacific Rim International Symposium on Dependable Computing (PRDC '06), pages 329--340. IEEE Computer Society, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. G. Venkataramani, B. Roemer, Y. Solihin, and M. Prvulovic. Memtracker: Efficient and programmable support for memory access monitoring and debugging. In Proceedings of the 13th International Symposium on High-Performance Computer Architecture (HPCA'07), pages 273--284. IEEE Computer Society, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. P. R. Wilson, M. S. Johnstone, M. Neely, and D. Boles. Dynamic storage allocation: A survey and critical review. In Proceedings of the International Workshop on Memory Management, volume 986, pages 1--116, Kinross, Scotland, Sept. 1995. Springer. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. Y. Xie and A. Aiken. Context-and path-sensitive memory leak detection. In Proceedings of the 5th Joint Meeting of the European Software Engineering Conference and the ACM SIGSOFT Symposium on the Foundations of Software Engineering (ESAC/FSE '05), pages 115--125, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. T. Yang, E. D. Berger, S. F. Kaplan, and J. E. B. Moss. CRAMM: Virtual memory support for garbage-collected applications. In 7th Symposium on Operating Systems Design and Implementation (OSDI'06), pages 103--116. USENIX Association, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Efficiently and precisely locating memory leaks and bloat

        Recommendations

        Comments

        Login options

        Check if you have access through your login credentials or your institution to get full access on this article.

        Sign in

        Full Access

        • Published in

          cover image ACM SIGPLAN Notices
          ACM SIGPLAN Notices  Volume 44, Issue 6
          PLDI '09
          June 2009
          478 pages
          ISSN:0362-1340
          EISSN:1558-1160
          DOI:10.1145/1543135
          Issue’s Table of Contents
          • cover image ACM Conferences
            PLDI '09: Proceedings of the 30th ACM SIGPLAN Conference on Programming Language Design and Implementation
            June 2009
            492 pages
            ISBN:9781605583921
            DOI:10.1145/1542476

          Copyright © 2009 ACM

          Publisher

          Association for Computing Machinery

          New York, NY, United States

          Publication History

          • Published: 15 June 2009

          Check for updates

          Qualifiers

          • research-article

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader
        About Cookies On This Site

        We use cookies to ensure that we give you the best experience on our website.

        Learn more

        Got it!