Space Efficient Conservative Garbage Collection Hans-Juergen Boehm, Xerox PARC Presented by Ryan Braud.

Slides:



Advertisements
Similar presentations
Chapter 22 Implementing lists: linked implementations.
Advertisements

Singly linked lists Doubly linked lists
Garbage collection David Walker CS 320. Where are we? Last time: A survey of common garbage collection techniques –Manual memory management –Reference.
Dynamic Memory Management
Introduction to Memory Management. 2 General Structure of Run-Time Memory.
Chapter 6 Data Types
1 Overview Assignment 5: hints  Garbage collection Assignment 4: solution.
Names and Bindings.
PZ10B Programming Language design and Implementation -4th Edition Copyright©Prentice Hall, PZ10B - Garbage collection Programming Language Design.
Lecture 10: Heap Management CS 540 GMU Spring 2009.
Garbage Collection What is garbage and how can we deal with it?
Bounding Space Usage of Conservative Garbage Collectors Ohad Shacham December 2002 Based on work by Hans-J. Boehm.
5. Memory Management From: Chapter 5, Modern Compiler Design, by Dick Grunt et al.
Various languages….  Could affect performance  Could affect reliability  Could affect language choice.
Garbage Collection CSCI 2720 Spring Static vs. Dynamic Allocation Early versions of Fortran –All memory was static C –Mix of static and dynamic.
Elementary Data Types Prof. Alamdeep Singh. Scalar Data Types Scalar data types represent a single object, i.e. only one value can be derived. In general,
Hastings Purify: Fast Detection of Memory Leaks and Access Errors.
CS 326 Programming Languages, Concepts and Implementation Instructor: Mircea Nicolescu Lecture 18.
CPSC 388 – Compiler Design and Construction
Mark and Sweep Algorithm Reference Counting Memory Related PitFalls
CS 536 Spring Automatic Memory Management Lecture 24.
CSC321: Programming Languages 11-1 Programming Languages Tucker and Noonan Chapter 11: Memory Management 11.1 The Heap 11.2 Implementation of Dynamic Arrays.
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.
Memory Allocation. Three kinds of memory Fixed memory Stack memory Heap memory.
Run-Time Storage Organization
The environment of the computation Declarations introduce names that denote entities. At execution-time, entities are bound to values or to locations:
Reference Counters Associate a counter with each heap item Whenever a heap item is created, such as by a new or malloc instruction, initialize the counter.
1 Overview Assignment 6: hints  Living with a garbage collector Assignment 5: solution  Garbage collection.
OOP Languages: Java vs C++
A Real-Time Garbage Collector Based on the Lifetimes of Objects Henry Lieberman and Carl Hewitt (CACM, June 1983) Rudy Kaplan Depena CS395T: Memory Management.
Chapter 5: Programming Languages and Constructs by Ravi Sethi Activation Records Dolores Zage.
Comp 245 Data Structures Linked Lists. An Array Based List Usually is statically allocated; may not use memory efficiently Direct access to data; faster.
Storage Management. The stack and the heap Dynamic storage allocation refers to allocating space for variables at run time Most modern languages support.
Basic Semantics Associating meaning with language entities.
Simulated Pointers Limitations Of Java Pointers May be used for internal data structures only. Data structure backup requires serialization and deserialization.
1 Records Record aggregate of data elements –Possibly heterogeneous –Elements/slots are identified by names –Elements in same fixed order in all records.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. C H A P T E R F I V E Memory Management.
1 Dynamic Memory Allocation –The need –malloc/free –Memory Leaks –Dangling Pointers and Garbage Collection Today’s Material.
Heap storage & Garbage collection Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001.
ISBN Chapter 6 Data Types Pointer Types Reference Types Memory Management.
GARBAGE COLLECTION IN AN UNCOOPERATIVE ENVIRONMENT Hans-Juergen Boehm Computer Science Dept. Rice University, Houston Mark Wieser Xerox Corporation, Palo.
Objects and Variables Local variables – Confined to single context: allocated on stack – Primitive types such as int or object references – Must be initialized.
Spring, 2011 –– Computational Thinking – Dennis Kafura – CS 2984 Data Structures Mapping complex structures to linear memory.
Simulated Pointers Limitations Of C++ Pointers May be used for internal data structures only. Data structure backup requires serialization and deserialization.
Announcements There is a Quiz today. There were problems with grading assignment 2, but they should be worked out today The web page for correcting the.
CSE 351 Dynamic Memory Allocation 1. Dynamic Memory Dynamic memory is memory that is “requested” at run- time Solves two fundamental dilemmas: How can.
An Efficient, Incremental, Automatic Garbage Collector P. Deutsch and D. Bobrow Ivan JibajaCS 395T.
Sections Basic Data Structures. 1.5 Data Structures The way you view and structure the data that your programs manipulate greatly influences your.
Memory Management in Java Mr. Gerb Computer Science 4.
Data Types Chapter 6: Data Types Lectures # 13. Topics Chapter 6: Data Types 2 Introduction Primitive Data Types Character String Types Array Types Associative.
CSC 533: Programming Languages Spring 2016
Object Lifetime and Pointers
Garbage Collection What is garbage and how can we deal with it?
Lecture 6 of Computer Science II
CSC 533: Programming Languages Spring 2015
Inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture 7 – More Memory Management Lecturer PSOE Dan Garcia
Rifat Shahriyar Stephen M. Blackburn Australian National University
Storage Management.
Concepts of programming languages
Memory Allocation CS 217.
Effective and Efficient memory Protection Using Dynamic Tainting
Heap storage & Garbage collection
List Allocation and Garbage Collection
RUN-TIME STORAGE Chuen-Liang Chen Department of Computer Science
Heap storage & Garbage collection
Garbage collection Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section
Inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture 7 – More Memory Management Lecturer PSOE Dan Garcia
CSC 533: Programming Languages Spring 2019
Garbage Collection What is garbage and how can we deal with it?
Presentation transcript:

Space Efficient Conservative Garbage Collection Hans-Juergen Boehm, Xerox PARC Presented by Ryan Braud

Garbage Collectors Reclaim storage allocated by a program that is no longer accessible Minimizes the need for explicit memory management Used in languages today like Java, D, Ruby, etc Even as a C/C++ library!

Conservative Garbage Collectors Operate with minimal information about the layout of data Do not rely on compiler provided information about the location of pointers Assumes any bit pattern that could be a pointer actually is

Why Be Conservative? Have been used successfully in large C programs Can be used to debug programs that explicitly deallocate memory Make it possible to easily compile other programming languages that require garbage collection into efficient C

Problems with Conservatism Memory “leakage” in some circumstances Significant amounts of inaccessible memory are not reclaimed Ad hoc solutions exist, but nothing systematic

Pointer Misidentification Most apparent source of excess memory retention Non-pointers incorrectly assumed to be pointers

Pointer Misidentification A* a = new A(); int x = (int)a; a = NULL; x is now a “reference” to a, even though a should be garbage collected a Unaligned accessInvalid reference “Address”

Solution Ensure garbage collections occur at regular intervals “Blacklist” invalid pointers that could become valid addresses in the future Do not allocate objects at or across blacklisted addresses Reclaim blacklisted addresses if they do not appear in a future collection

Blacklisting mark(p) { if p is not a valid object address if p is in the vicinity of the heap add p to blacklist return if p is marked return set mark bit for p for each field q in the object referenced by p mark(q) }

Implementation Details Blacklist entire pages, not individual addresses Implemented as a bit array, one per page For a discontiguous heap, hash table with one bit per entry

Evaluation Ran program T on three different architectures and under PCR Allocates 200 circular linked lists containing 100 Kbytes each, then assigns head of each list to 0 Compared amount of unclaimed memory with that of non-blacklisting garbage collector Collector configured such that any “reference” to any of the 100,000 addresses in a list causes entire list to be retained

Results MachineOptimized?No BlacklistingBlacklisting SPARC(s)No %0-.5% SPARC(s)Yes %.5-1% SPARC(d)No8-9.5%.5% SPARC(d)Yes9-11.5%0-.5% SGI(s)No1.5-8%0% SGI(s)Yes1-4%0% OS/2(s)No28%3% OS/2(d)Yes26%1% PCRMixed % %

Conclusions Blacklisting an effective technique in reducing longterm accidental storage retention Easy to implement and only approx. 1% slowdown vs non-blacklisting garbage collector