Using Cyclic Memory Allocation to Eliminate Memory Leaks

We present and evaluate a new memory management technique foreliminating memory leaks in programs with dynamic memoryallocation. This technique observes the execution of the program on asequence of training inputsto find m-bounded allocation sites,which have the property that at any time during the...

Full description

Bibliographic Details
Main Authors: Nguyen, Huu Hai, Rinard, Martin
Other Authors: Computer Architecture
Language:en_US
Published: 2005
Online Access:http://hdl.handle.net/1721.1/30579
_version_ 1826209857972207616
author Nguyen, Huu Hai
Rinard, Martin
author2 Computer Architecture
author_facet Computer Architecture
Nguyen, Huu Hai
Rinard, Martin
author_sort Nguyen, Huu Hai
collection MIT
description We present and evaluate a new memory management technique foreliminating memory leaks in programs with dynamic memoryallocation. This technique observes the execution of the program on asequence of training inputsto find m-bounded allocation sites,which have the property that at any time during the execution of theprogram, the program accesses at most only the last m objects allocated atthat site. The technique then transforms the program to usecyclic memory allocation at that site: it preallocates a buffercontaining m objects of the type allocated at that site, with eachallocation returning the next object in the buffer. At the end of thebuffer the allocations wrap back around to the first object. Cyclicallocation eliminates any memory leak at the allocation site - thetotal amount of memory required to hold all of the objects everallocated at the site is simply $m$ times the object size.We evaluate our technique by applying it to several widely-used opensource programs. Our results show that it is able to successfullyeliminate important memory leaks in these programs. A potentialconcern is that the estimated bounds m may be too small, causing theprogram to overlay live objects in memory. Our results indicate thatour bounds estimation technique is quite accurate in practice,providing incorrect results for only one of the 160 m-bounded sitesthat it identifies. To evaluate the potential impact ofoverlaying live objects, we artificially reduce the bounds at$m$-bounded sites and observe the resulting behavior.The resulting overlayingof live objects often does not affect thefunctionality of the program at all; even when it does impairpart of the functionality, the program does not fail andis still able to acceptably deliver the remaining functionality.
first_indexed 2024-09-23T14:33:02Z
id mit-1721.1/30579
institution Massachusetts Institute of Technology
language en_US
last_indexed 2024-09-23T14:33:02Z
publishDate 2005
record_format dspace
spelling mit-1721.1/305792019-04-12T08:26:35Z Using Cyclic Memory Allocation to Eliminate Memory Leaks Nguyen, Huu Hai Rinard, Martin Computer Architecture We present and evaluate a new memory management technique foreliminating memory leaks in programs with dynamic memoryallocation. This technique observes the execution of the program on asequence of training inputsto find m-bounded allocation sites,which have the property that at any time during the execution of theprogram, the program accesses at most only the last m objects allocated atthat site. The technique then transforms the program to usecyclic memory allocation at that site: it preallocates a buffercontaining m objects of the type allocated at that site, with eachallocation returning the next object in the buffer. At the end of thebuffer the allocations wrap back around to the first object. Cyclicallocation eliminates any memory leak at the allocation site - thetotal amount of memory required to hold all of the objects everallocated at the site is simply $m$ times the object size.We evaluate our technique by applying it to several widely-used opensource programs. Our results show that it is able to successfullyeliminate important memory leaks in these programs. A potentialconcern is that the estimated bounds m may be too small, causing theprogram to overlay live objects in memory. Our results indicate thatour bounds estimation technique is quite accurate in practice,providing incorrect results for only one of the 160 m-bounded sitesthat it identifies. To evaluate the potential impact ofoverlaying live objects, we artificially reduce the bounds at$m$-bounded sites and observe the resulting behavior.The resulting overlayingof live objects often does not affect thefunctionality of the program at all; even when it does impairpart of the functionality, the program does not fail andis still able to acceptably deliver the remaining functionality. 2005-12-22T02:40:21Z 2005-12-22T02:40:21Z 2005-10-26 MIT-CSAIL-TR-2005-069 MIT-LCS-TR-1008 http://hdl.handle.net/1721.1/30579 en_US Massachusetts Institute of Technology Computer Science and Artificial Intelligence Laboratory 10 p. 20338887 bytes 816035 bytes application/postscript application/pdf application/postscript application/pdf
spellingShingle Nguyen, Huu Hai
Rinard, Martin
Using Cyclic Memory Allocation to Eliminate Memory Leaks
title Using Cyclic Memory Allocation to Eliminate Memory Leaks
title_full Using Cyclic Memory Allocation to Eliminate Memory Leaks
title_fullStr Using Cyclic Memory Allocation to Eliminate Memory Leaks
title_full_unstemmed Using Cyclic Memory Allocation to Eliminate Memory Leaks
title_short Using Cyclic Memory Allocation to Eliminate Memory Leaks
title_sort using cyclic memory allocation to eliminate memory leaks
url http://hdl.handle.net/1721.1/30579
work_keys_str_mv AT nguyenhuuhai usingcyclicmemoryallocationtoeliminatememoryleaks
AT rinardmartin usingcyclicmemoryallocationtoeliminatememoryleaks