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

Slides:



Advertisements
Similar presentations
An Implementation of Mostly- Copying GC on Ruby VM Tomoharu Ugawa The University of Electro-Communications, Japan.
Advertisements

Virtual Memory (II) CSCI 444/544 Operating Systems Fall 2008.
Introduction to Memory Management. 2 General Structure of Run-Time Memory.
Automatic Memory Management Noam Rinetzky Schreiber 123A /seminar/seminar1415a.html.
Lecture 10: Heap Management CS 540 GMU Spring 2009.
Prof. Necula CS 164 Lecture 141 Run-time Environments Lecture 8.
Parallel and Distributed Simulation Time Warp: Other Mechanisms.
Hastings Purify: Fast Detection of Memory Leaks and Access Errors.
Using Programmer-Written Compiler Extensions to Catch Security Holes Authors: Ken Ashcraft and Dawson Engler Presented by : Hong Chen CS590F 2/7/2007.
CPSC 388 – Compiler Design and Construction
Chapter 8 Runtime Support. How program structures are implemented in a computer memory? The evolution of programming language design has led to the creation.
Memory Management. History Run-time management of dynamic memory is a necessary activity for modern programming languages Lisp of the 1960’s was one of.
Online Performance Auditing Using Hot Optimizations Without Getting Burned Jeremy Lau (UCSD, IBM) Matthew Arnold (IBM) Michael Hind (IBM) Brad Calder (UCSD)
CS 536 Spring Run-time organization Lecture 19.
Run time vs. Compile time
Memory Allocation and Garbage Collection. Why Dynamic Memory? We cannot know memory requirements in advance when the program is written. We cannot know.
An Adaptive, Region-based Allocator for Java Feng Qian & Laurie Hendren 2002.
C and Data Structures Baojian Hua
Run-time Environment and Program Organization
1 Run time vs. Compile time The compiler must generate code to handle issues that arise at run time Representation of various data types Procedure linkage.
University of California San Diego Locality Phase Prediction Xipeng Shen, Yutao Zhong, Chen Ding Computer Science Department, University of Rochester Class.
Memory Layout C and Data Structures Baojian Hua
SEG Advanced Software Design and Reengineering TOPIC L Garbage Collection Algorithms.
Programming Languages and Paradigms Object-Oriented Programming.
COP4020 Programming Languages
P ARALLEL P ROCESSING I NSTITUTE · F UDAN U NIVERSITY 1.
CS3012: Formal Languages and Compilers The Runtime Environment After the analysis phases are complete, the compiler must generate executable code. The.
Dynamic Memory Allocation Questions answered in this lecture: When is a stack appropriate? When is a heap? What are best-fit, first-fit, worst-fit, and.
An Adaptive, Region-based Allocator for Java Feng Qian, Laurie Hendren {fqian, Sable Research Group School of Computer Science McGill.
Institute of Computing Technology On Improving Heap Memory Layout by Dynamic Pool Allocation Zhenjiang Wang Chenggang Wu Institute of Computing Technology,
Linking and Loading Linker collects procedures and links them together object modules into one executable program. Why isn't everything written as just.
CSC 253 Lecture 2. Some differences between Java and C  Compiled C code is machine specific, whereas Java compiles for a virt. machine.  Virtual machines.
1 Fast and Efficient Partial Code Reordering Xianglong Huang (UT Austin, Adverplex) Stephen M. Blackburn (Intel) David Grove (IBM) Kathryn McKinley (UT.
ACSAC’04 Choice Predictor for Free Mongkol Ekpanyapong Pinar Korkmaz Hsien-Hsin S. Lee School of Electrical and Computer Engineering Georgia Institute.
Computer Science and Software Engineering University of Wisconsin - Platteville 2. Pointer Yan Shi CS/SE2630 Lecture Notes.
Storage Bindings Allocation is the process by which the memory cell or collection of memory cells is assigned to a variable. These cells are taken from.
Simulated Pointers Limitations Of Java Pointers May be used for internal data structures only. Data structure backup requires serialization and deserialization.
A Principled Approach to Nondeferred Reference-Counting Garbage Collection † Pramod G. Joisha HP Labs, Palo Alto † This work was done when the author was.
1 Dynamic Memory Allocation –The need –malloc/free –Memory Leaks –Dangling Pointers and Garbage Collection Today’s Material.
COMP3190: Principle of Programming Languages
1 Garbage Collection Advantage: Improving Program Locality Xianglong Huang (UT) Stephen M Blackburn (ANU), Kathryn S McKinley (UT) J Eliot B Moss (UMass),
Heap liveness and its usage in automatic memory management Ran Shaham Elliot Kolodner Mooly Sagiv ISMM’02 Unpublished TVLA.
Consider Starting with 160 k of memory do: Starting with 160 k of memory do: Allocate p1 (50 k) Allocate p1 (50 k) Allocate p2 (30 k) Allocate p2 (30 k)
Simulated Pointers Limitations Of C++ Pointers May be used for internal data structures only. Data structure backup requires serialization and deserialization.
Software Engineering Prof. Dr. Bertrand Meyer March 2007 – June 2007 Chair of Software Engineering Lecture #20: Profiling NetBeans Profiler 6.0.
GC Assertions: Using the Garbage Collector To Check Heap Properties Samuel Z. Guyer Tufts University Edward Aftandilian Tufts University.
PINTOS: An Execution Phase Based Optimization and Simulation Tool) PINTOS: An Execution Phase Based Optimization and Simulation Tool) Wei Hsu, Jinpyo Kim,
Memory Management What if pgm mem > main mem ?. Memory Management What if pgm mem > main mem ? Overlays – program controlled.
Memory-Related Perils and Pitfalls in C
CSE 220 – C Programming malloc, calloc, realloc.
Optimistic Hybrid Analysis
Data Types In Text: Chapter 6.
Section 10: Memory Allocation Topics
Debugging Memory Issues
Garbage collection for C
Input Space Partition Testing CS 4501 / 6501 Software Testing
Unit-2 Objects and Classes
Storage Management.
Run-time organization
Concepts of programming languages
Reconsidering Custom Memory Allocation
Storage.
CS 3343: Analysis of Algorithms
Strategies for automatic memory management
Adaptive Code Unloading for Resource-Constrained JVMs
Hardware Counter Driven On-the-Fly Request Signatures
Dynamic Program Analysis
Languages and Compilers (SProg og Oversættere)
Program-level Adaptive Memory Management
Run-time environments
Presentation transcript:

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

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  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

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 NO GC Too lazy Preventive Adapt to program ’ s need

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 object allocation site