Presentation is loading. Please wait.

Presentation is loading. Please wait.

MSP’05 1 Gated Memory Control for Memory Monitoring, Leak Detection and Garbage Collection Chen Ding, Chengliang Zhang Xipeng Shen, Mitsunori Ogihara University.

Similar presentations


Presentation on theme: "MSP’05 1 Gated Memory Control for Memory Monitoring, Leak Detection and Garbage Collection Chen Ding, Chengliang Zhang Xipeng Shen, Mitsunori Ogihara University."— Presentation transcript:

1 MSP’05 1 Gated Memory Control for Memory Monitoring, Leak Detection and Garbage Collection Chen Ding, Chengliang Zhang Xipeng Shen, Mitsunori Ogihara University of Rochester 6/12/2005

2 MSP’05 2 Motivation  Modern software is large and complex  Dynamic memory allocation and reclamation are widely used  Problems Double deletions Dangling links Memory leaks …

3 MSP’05 3 Motivation (Cont.)  Decades of research has produced highly effective methods for managing dynamic objects  Existing methods usually work at the level of procedures and allocation sites  Recently, program phase analysis makes it possible to automatically identify high level phases which span thousands of lines of codes

4 MSP’05 4 Question How much the high-level phase information can benefit the dynamic memory management?

5 MSP’05 5  A phase is a unit of recurring behavior, and the boundaries of a phase can be uniquely marked in the program  Every phase instance corresponds to a section of the program execution  Phases reveal the high level structure of run-time program behavior Phase Phase instances of GCC with input cp-decl.i

6 MSP’05 6 Gated Memory Control Memory usage monitoring Object lifetime classification Preventive garbage collection

7 MSP’05 7 Outline  Motivation  Gated Memory Control Memory usage monitoring Object lifetime classification  Ranking memory usage  Detecting memory leaks  Directing object grouping Preventive garbage collection  Related work  Summary

8 MSP’05 8 Memory Usage Monitoring

9 MSP’05 9 Memory Usage Monitoring

10 MSP’05 10 Outline  Motivation  Gated Memory Control Memory usage monitoring Object lifetime classification  Ranking memory usage  Detecting memory leaks  Directing object grouping Preventive garbage collection  Related work  Summary

11 MSP’05 11 Object Lifetime Classification  Object lifetime: the number of phase instances between the first and the last use  Behavior of a dynamic memory object Phase local: the lifetime <=1 Phase global: otherwise

12 MSP’05 12 Allocation Site Classification  Allocation site: call sequence main()-> parser()-> malloc()  Behavior of an allocation site Phase local: all objects allocated at this site are phase local Phase global: otherwise

13 MSP’05 13 Ranking Memory Usage  Rank allocation sites based on Phase local the size of the memory allocated  Report the number/size of each class of the memory objects

14 MSP’05 14 Detecting Memory Leaks  A possible memory leak An allocation site is phase local, but some of its objects are not freed at the end of the phase  May raise false alarms  Problem of profiling: missing memory leaks Multiple training inputs to increase the coverage  Experiment results GCC in SPEC2000, all train and ref inputs are considered Some possible memory leaks

15 MSP’05 15 Directing Object Grouping  Group the objects by their lifetime  Put into different virtual memory pages  Advantages Save the physical memory usage Reduce the energy consumption

16 MSP’05 16 Outline  Motivation  Gated Memory Control Memory usage monitoring Object lifetime classification  Ranking memory usage  Detecting memory leaks  Directing object grouping Preventive garbage collection  Related work  Summary

17 MSP’05 17 Preventive Garbage Collection  Preventive GC Always call GC at the phase boundary Do not call GC during a phase, unless reaching the hard upper bound of available memory  Reactive (conventional) GC Run GC once the soft bound is reached, e.g. the previously collected free space is used up  No GC No GC unless the hard bound is reached

18 MSP’05 18 Comparison Balancing between the space consumption and the number of GC calls Not too many GCs called Not too much memory consumed Reactive Often too eager NO GC Too lazy Preventive Adapt to program ’ s need

19 MSP’05 19 Evaluations on xlisp xlisp in SPEC2000 with ref and train datasets as inputs

20 MSP’05 20 Related Work  Phase detection [Shen+ ASPLOS04] [Shen+ URCS TR848]  Object lifetime and memory leak detection [Chilimbi&Hauswirth ASPLOS ’ 04, Hirzel+ TOPLAS ’ 02, Zorn&Seidl ASPLOS ’ 98, Barrett&Zorn PLDI ’ 93]  Using GC for improving locality [Huang+ OOPSLA ’ 04, Chilimbi&Larus ISMM ’ 98, Wilson+ PLDI ’ 91]  Explicit memory allocation [Berger+ OOPSLA ’ 02/PLDI ’ 02, Wilson+ ISMM ’ 95]

21 MSP’05 21 Summary  Monitoring memory usage at the phase boundary shows the trend better than the traditional moving average method does  By analyzing the object lifetime, we have detected possible memory leaks in GCC  Preventive garbage collection improves the execution time of xlisp by up to 44% over the default reactive garbage collection

22 MSP’05 22 Questions? Thanks!

23 MSP’05 23 object allocation site


Download ppt "MSP’05 1 Gated Memory Control for Memory Monitoring, Leak Detection and Garbage Collection Chen Ding, Chengliang Zhang Xipeng Shen, Mitsunori Ogihara University."

Similar presentations


Ads by Google