Using Cyclic Memory Allocation to Eliminate Memory Leaks
Abstract
We present and evaluate a new memory management technique for eliminating memory leaks in programs with dynamic memory allocation. This technique observes the execution of the program on a sequence of training 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. The technique then 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 allocation eliminates any memory leak at the allocation site -- the total amount of memory required to hold all of the objects ever allocated at the site is simply m times the object size. We evaluate out technique by applying it to several widely-used open source programs. Our results show that it is able to successfully eliminate important memory leaks in these programs.
Document Details
- Document Type
- Technical Report
- Publication Date
- Oct 26, 2005
- Accession Number
- ADA466771
Entities
People
- Huu H. Nguyen
- Martin Rinard
Organizations
- Massachusetts Institute of Technology