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.
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- R. E. Jones and R. Lins. Garbage Collection: Algorithms for Automatic Dynamic Memory Management. Wiley, Chichester, July 1996. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- P.-H. Kamp. Malloc(3) revisited. http://phk.freebsd.dk/pubs/malloc.pdf. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- D. Lea. A memory allocator. http://gee.cs.oswego.edu/dl/html/malloc.html, 1997.Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Cross Ref
- Microsoft TechNet, Microsoft Corporation. Memory Leak Diagnoser, Dec. 2007.Google Scholar
- 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 Scholar
Cross Ref
- Mozilla.org. [email protected], 2008. {Online; accessed 12-March-2008}.Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- Standard Performance Evaluation Corporation. SPEC2006. http://www.spec.org.Google Scholar
- 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 Scholar
Digital Library
- L. Torvalds. Linux kernel mailing list post. http://lkml.org/lkml/2004/1/12/265, 1 2004.Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
Index Terms
Efficiently and precisely locating memory leaks and bloat
Recommendations
Efficiently and precisely locating memory leaks and bloat
PLDI '09: Proceedings of the 30th ACM SIGPLAN Conference on Programming Language Design and ImplementationInefficient 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 ...
Diagnosing memory leaks using graph mining on heap dumps
KDD '10: Proceedings of the 16th ACM SIGKDD international conference on Knowledge discovery and data miningMemory leaks are caused by software programs that prevent the reclamation of memory that is no longer in use. They can cause significant slowdowns, exhaustion of available storage space and, eventually, application crashes. Detecting memory leaks is ...
Automated memory leak detection for production use
ICSE 2014: Proceedings of the 36th International Conference on Software EngineeringThis paper presents Sniper, an automated memory leak detection tool for C/C++ production software. To track the staleness of allocated memory (which is a clue to potential leaks) with little overhead (mostly <3%), Sniper leverages instruction sampling ...







Comments