1 / 23

Gated Memory Control for Memory Monitoring, Leak Detection and Garbage Collection

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. Motivation. Modern software is large and complex Dynamic memory allocation and reclamation are widely used

navarro
Download Presentation

Gated Memory Control for Memory Monitoring, Leak Detection and Garbage Collection

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  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 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 • … 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 MSP’05

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

  5. Phase • 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 instances of GCC with input cp-decl.i MSP’05

  6. Gated Memory Control Memory usage monitoring Object lifetime classification Preventive garbage collection 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 MSP’05

  8. Memory Usage Monitoring MSP’05

  9. Memory Usage Monitoring 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 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 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 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 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 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 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 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 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 Preventive Adapt to program’s need NO GC Too lazy MSP’05

  19. Evaluations on xlisp xlisp in SPEC2000 with ref and train datasets as inputs 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] 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 MSP’05

  22. Questions? Thanks! MSP’05

  23. allocation site object MSP’05

More Related