|
ABSTRACT
We present and evaluate a new technique for detecting and eliminating memory leaks in programs with dynamic memory allocation. This technique observes the execution of the program on a sequence oftraining inputs to find m-bounded allocation sites, which have the property that at any time during the execution of the program, the program accesses at most only the last m objects allocated at that site. If the difference between the number of allocated and deallocated objects from the site grows above m throughout the computation, there is a memory leak at that site. To eliminate the leak, the technique transforms the program to use cyclic memory allocation at that site: it preallocates a buffer containing m objects of the type allocated at that site, with each allocation returning the next object in the buffer. At the end of the buffer the allocations wrap back around to the first object. Cyclic allocationeliminates any memory leak at the allocation site -- the total amountof memory required to hold all of the objects ever allocated at the site is simply m times the object size. We evaluate our technique by applying it to several widely-used open source programs. Our results show that it is able to successfully detect and eliminate important memory leaks in these programs. Apotential concern is that the estimated bounds m may be too small, causing the program to overlay live objects in memory. Our results indicate that our bounds estimation technique is quite accurate in practice, providing incorrect results for only one of the 160 m-bounded sites that it identifies. To evaluate the potential impact of overlaying live objects, we artificially reduce the bounds at m-bounded sites and observe the resulting behavior. The resulting overlaying of live objects often does not affect the functionality ofthe program at all; even when it does impair part of the functionality, the program does not fail and is still able to acceptably deliver the remaining functionality.
REFERENCES
Note: OCR errors may be found in this Reference List extracted from the full text article. ACM has opted to expose the complete List rather than only correct and linked references.
| |
1
|
CVE--2002--0069. http://cve.mitre.org/cgi--bin/cvename.cgi?name=CVE--2002--0069.
|
| |
2
|
Freeciv website. http://www.freeciv.org/.
|
| |
3
|
Pine website. http://www.washington.edu/pine/.
|
| |
4
|
Squid Web Proxy Cache website. http://www.squid--cache.org/.
|
| |
5
|
Valgrind website. http://www.valgrind.org/.
|
| |
6
|
K. Arkoudas and M. Rinard. Deductive runtime certification. In Proceedings of the 2004 Workshop on Runtime Verification (RV all2004), Barcelona, Spain, April 2004.
|
 |
7
|
Bruno Blanchet, Escape analysis for object-oriented languages: application to Java, Proceedings of the 14th ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications, p.20-34, November 01-05, 1999, Denver, Colorado, United States
|
 |
8
|
|
 |
9
|
|
| |
10
|
|
 |
11
|
Brian Demsky , Martin Rinard, Automatic detection and repair of errors in data structures, Proceedings of the 18th annual ACM SIGPLAN conference on Object-oriented programing, systems, languages, and applications, October 26-30, 2003, Anaheim, California, USA
|
 |
12
|
|
| |
13
|
|
 |
14
|
|
 |
15
|
Jong-Deok Choi , Manish Gupta , Mauricio Serrano , Vugranam C. Sreedhar , Sam Midkiff, Escape analysis for Java, Proceedings of the 14th ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications, p.1-19, November 01-05, 1999, Denver, Colorado, United States
|
| |
16
|
|
| |
17
|
D. Detlefs, A. Dosser, and B. Zorn. Memory Allocation Costs in Large C and C++ Programs. Technical Report CU--CS--665--93, University of Colorado, Boulder, August 1993.
|
| |
18
|
Octavian--Daniel Dumitran. Fixing file descriptor leaks. Master's thesis, Massachusetts Institute of Technology, June 2007.
|
| |
19
|
|
 |
20
|
|
 |
21
|
Ovidiu Gheorghioiu , Alexandru Salcianu , Martin Rinard, Interprocedural compatibility analysis for static object preallocation, Proceedings of the 30th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, p.273-284, January 15-17, 2003, New Orleans, Louisiana, USA
|
 |
22
|
|
| |
23
|
R. Hastings and B. Joyce. Purify: Fast detection of memory leaks and access errors. In Proceedings of the Winter USENIX Conference, December 1992.
|
 |
24
|
|
 |
25
|
|
| |
26
|
Martin Rinard , Cristian Cadar , Daniel Dumitran , Daniel M. Roy , Tudor Leu , William S. Beebee, Jr., Enhancing server availability and security through failure-oblivious computing, Proceedings of the 6th conference on Symposium on Opearting Systems Design & Implementation, p.21-21, December 06-08, 2004, San Francisco, CA
|
| |
27
|
Ran Shaham, Eran Yahav, Elliot K. Kolodner, and Mooly Sagiv. Establishing Local Temporal Heap Safety Properties with Applications to Compile--Time Memory Management. In The 10th Annual International Static Analysis Symposium (SAS '03), June 2003.
|
| |
28
|
|
 |
29
|
John Whaley , Martin Rinard, Compositional pointer and escape analysis for Java programs, Proceedings of the 14th ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications, p.187-206, November 01-05, 1999, Denver, Colorado, United States
|
 |
30
|
|
| |
31
|
|
CITED BY 5
|
|
Yan Tang , Yan Tang , Qi Gao , Qi Gao , Feng Qin , Feng Qin, LeakSurvivor: towards safely tolerating memory leaks for garbage-collected languages, USENIX 2008 Annual Technical Conference on Annual Technical Conference, p.307-320, June 22-27, 2008, Boston, Massachusetts
|
|
|
|
|
|
|
|
|
|
|
|
|
|