Program Analysis. Uday Khedker. ( uday) Department of Computer Science and Engineering, Indian Institute of Technology, Bombay
|
|
- Sharon Stewart
- 5 years ago
- Views:
Transcription
1 Program Analysis ( uday) Department of Computer Science and Engineering, Indian Institute of Technology, Bombay January 2008
2 Part 1 About These Slides
3 CS 618 Program Analysis: About These Slides 1/19 Copyright These slides are in the series of lectures on CS638 Program Analysis course at. A large part of these slides are based on the following material: 1., Amitabha Sanyal, and Amey Karkare. Heap Reference Analysis Using Access Graphs. ACM Transactions on Programming Languages and Systems, 30(1), Nov , Amitabha Sanyal, and Bageshri Karkare. Data Flow Analysis: Theory and Practice. CRC Press USA. (Under Publication) 3.. Data Flow Analysis. In The Compiler Design Handbook. Editors: Priti Shankar and Y. N. Srikant. CRC Press USA (2) is not yet published and the copyrights are reserved by the authors. The copyright for (1) is held by ACM and that for (3) is held by CRC Press USA. These slides may be used only for academic purposes.
4 CS 618 Program Analysis: About These Slides 2/19 Standard Memory Architecture of Programs Static Data Heap allocation provides the flexibility of Stack Variable Sizes. Data structures can grow or shrink as desired at runtime. (Not bound to the declarations in program.) Heap Code Variable Lifetimes. Data structures can be created and destroyed as desired at runtime. (Not bound to the activations of procedures.)
5 CS 618 Program Analysis: About These Slides 3/19 Managing Heap Memory Decision 1: When to Allocate? Explicit. Specified in the programs. (eg. Imperative/OO languages) Implicit. Decided by the language processors. (eg. Declarative Languages)
6 CS 618 Program Analysis: About These Slides 3/19 Managing Heap Memory Decision 1: When to Allocate? Explicit. Specified in the programs. (eg. Imperative/OO languages) Implicit. Decided by the language processors. (eg. Declarative Languages) Decision 2: When to Deallocate? Explicit. Manual Memory Management (eg. C/C++) Implicit. Automatic Memory Management aka Garbage Collection (eg. Java/Declarative languages)
7 CS 618 Program Analysis: About These Slides 4/19 State of Art in Manual Deallocation Memory leaks 10% to 20% of last development effort goes in plugging leaks Tool assisted manual plugging Purify, Electric Fence, RootCause, GlowCode, yaktest, Leak Tracer, BDW Garbage Collector, mtrace, memwatch, dmalloc etc. All leak detectors are dynamic (and hence specific to execution instances) generate massive reports to be perused by programmers usually do not locate last use but only allocation escaping a call At which program point should a leak be plugged?
8 CS 618 Program Analysis: About These Slides 5/19 Garbage Collection Automatic Deallocation Retain active data structure. Deallocate inactive data structure. What is an Active Data Structure?
9 CS 618 Program Analysis: About These Slides 5/19 Garbage Collection Automatic Deallocation Retain active data structure. Deallocate inactive data structure. What is an Active Data Structure? If an object does not have an access path, (i.e. it is unreachable) then its memory can be reclaimed.
10 CS 618 Program Analysis: About These Slides 5/19 Garbage Collection Automatic Deallocation Retain active data structure. Deallocate inactive data structure. What is an Active Data Structure? If an object does not have an access path, (i.e. it is unreachable) then its memory can be reclaimed. What if an object has an access path, but is not accessed after the given program point?
11 CS 618 Program Analysis: About These Slides 6/19 What is Garbage? Garbage 1 w = x // x points to m a 2 if (x.data < max) 3 x = x. 4 y = x. 5 z = New class of z 6 y = y. 7 z.sum = x.data + y.data Garbage z x w y Stack p a q b i c f j m Heap d e g h k l n o
12 CS 618 Program Analysis: About These Slides 6/19 What is Garbage? False Garbage 1 w = x // x points to m a 2 if (x.data < max) 3 x = x. 4 y = x. 5 z = New class of z 6 y = y. 7 z.sum = x.data + y.data Garbage z x w y Stack p a q b i c f j m Heap d e g h k l n o
13 CS 618 Program Analysis: About These Slides 6/19 What is Garbage? True Garbage 1 w = x // x points to m a 2 if (x.data < max) 3 x = x. 4 y = x. 5 z = New class of z 6 y = y. 7 z.sum = x.data + y.data Garbage z x w y Stack p a q b i c f j m Heap d e g h k l n o
14 CS 618 Program Analysis: About These Slides 6/19 What is Garbage? Garbage 1 w = x // x points to m a 2 if (x.data < max) 3 x = x. 4 y = x. 5 z = New class of z 6 y = y. 7 z.sum = x.data + y.data Garbage z x w y Stack p a q b i c f j m Heap d e g h k l n o All white nodes are unused and should be considered garbage
15 CS 618 Program Analysis: About These Slides 7/19 Is Reachable Same as Live? From live (also known as alive, active) : Memory(2) or an object is live if the program will read from it in future. The term is often used more broadly to mean reachable. It is not possible, in general, for garbage collectors to determine exactly which objects are still live. Instead, they use some approximation to detect objects that are provably dead, such as those that are not reachable. Similar terms: reachable. Opposites: dead. See also: undead.
16 CS 618 Program Analysis: About These Slides 8/19 Is Reachable Same as Live? Not really. Most of us know that. Even with the state of art of garbage collection, 24% to 76% unused memory remains unclaimed Yet we have no way of distinguishing. Over a dozen reported approaches (since 1996), no real success.
17 CS 618 Program Analysis: About These Slides 9/19 Cedar Mesa Folk Wisdom Make the unused memory unreachable by setting references to NULL. (GC FAQ: z x w y p a q b i X X c f j m d e g h k l n o Stack Heap
18 CS 618 Program Analysis: About These Slides 9/19 Cedar Mesa Folk Wisdom Make the unused memory unreachable by setting references to NULL. (GC FAQ: z x w y p a q b i c f j m d e g h k l n o Stack Heap
19 CS 618 Program Analysis: About These Slides 10/19 Cedar Mesa Folk Wisdom Most promising, simplest to understand, yet the hardest to implement. Which references should be set to NULL? Most approaches rely on feedback from profiling. No systematic and clean solution.
20 CS 618 Program Analysis: About These Slides 11/19 Distinguishing Between Reachable and Live The state of art Eliminating objects reachable from root variables which are not live. Implemented in current Sun JVMs. Uses liveness data flow analysis of root variables (stack data). What about liveness of heap data?
21 CS 618 Program Analysis: About These Slides 12/19 Liveness of Stack Data 1 w = x // x points to m a 2 while (x.data < max) Heap 3 x = x. 4 y = x. 5 z = New class of z 6 y = y. Stack 7 z.sum = x.data + y.data if changed to while
22 CS 618 Program Analysis: About These Slides 13/19 Liveness of Stack Data w = x while (x.data < max) x = x. y = x. z = New class of z y = y. z.sum = x.data + y.data No variable is used beyond this program point
23 CS 618 Program Analysis: About These Slides 13/19 Liveness of Stack Data w = x while (x.data < max) x = x. y = x. z = New class of z Current values of x, y, and z are used beyond this program point y = y. z.sum = x.data + y.data Live Dead
24 CS 618 Program Analysis: About These Slides 13/19 Liveness of Stack Data w = x while (x.data < max) y = x. x = x. Current values of x, y, and z are used beyond this program point The value of y is different before and after the assignment to y z = New class of z y = y. z.sum = x.data + y.data
25 CS 618 Program Analysis: About These Slides 13/19 Liveness of Stack Data w = x while (x.data < max) y = x. x = x. The current values of x and y are used beyond this program point The current value of z is not used beyond this program point z = New class of z y = y. z.sum = x.data + y.data
26 CS 618 Program Analysis: About These Slides 13/19 Liveness of Stack Data w = x while (x.data < max) x = x. y = x. z = New class of z y = y. The current values of x is used beyond this program point Current values of y and z are not used beyond this program point z.sum = x.data + y.data
27 CS 618 Program Analysis: About These Slides 13/19 Liveness of Stack Data w = x while (x.data < max) x = x. y = x. z = New class of z y = y. Nothing is known as of now Some information will be available in the next iteration point z.sum = x.data + y.data
28 CS 618 Program Analysis: About These Slides 13/19 Liveness of Stack Data w = x while (x.data < max) y = x. x = x. z = New class of z Current value of x is used beyond this program point However its value is different before and after the assignment y = y. z.sum = x.data + y.data
29 CS 618 Program Analysis: About These Slides 13/19 Liveness of Stack Data w = x while (x.data < max) x = x. y = x. z = New class of z Current value of x is used beyond this program point There are two control flow paths beyond this program point y = y. z.sum = x.data + y.data
30 CS 618 Program Analysis: About These Slides 13/19 Liveness of Stack Data w = x while (x.data < max) x = x. Current value of x is used beyond this program point y = x. z = New class of z y = y. z.sum = x.data + y.data
31 CS 618 Program Analysis: About These Slides 13/19 Liveness of Stack Data w = x while (x.data < max) Current value of x is used beyond this program point x = x. y = x. z = New class of z y = y. z.sum = x.data + y.data
32 CS 618 Program Analysis: About These Slides 13/19 Liveness of Stack Data w = x while (x.data < max) x = x. y = x. z = New class of z y = y. z.sum = x.data + y.data End of iteration #1 Live Dead
33 CS 618 Program Analysis: About These Slides 13/19 Liveness of Stack Data w = x while (x.data < max) x = x. y = x. z = New class of z y = y. z.sum = x.data + y.data End of iteration #2 Live Dead
34 CS 618 Program Analysis: About These Slides 14/19 Applying Cedar Mesa Folk Wisdom to Heap Data Liveness Analysis of Heap Data If the while loop is not executed even once. 1 w = x // x points to m a 2 while (x.data < max) 3 x = x. 4 y = x. 5 z = New class of z 6 y = y. 7 z.sum = x.data + y.data z x w y p a q b i c f j m d e g h k l n o Stack Heap
35 CS 618 Program Analysis: About These Slides 14/19 Applying Cedar Mesa Folk Wisdom to Heap Data Liveness Analysis of Heap Data If the while loop is executed once. 1 w = x // x points to m a 2 while (x.data < max) 3 x = x. 4 y = x. 5 z = New class of z 6 y = y. 7 z.sum = x.data + y.data z x w y p a q b i c f j m d e g h k l n o Stack Heap
36 CS 618 Program Analysis: About These Slides 14/19 Applying Cedar Mesa Folk Wisdom to Heap Data Liveness Analysis of Heap Data If the while loop is executed twice. 1 w = x // x points to m a 2 while (x.data < max) 3 x = x. 4 y = x. 5 z = New class of z 6 y = y. 7 z.sum = x.data + y.data z x w y p a q b i c f j m d e g h k l n o Stack Heap
37 CS 618 Program Analysis: About These Slides 15/19 The Moral of the Story Mappings between access expressions and l-values keep changing This is a rule for heap data For stack and static data, it is an exception! Static analysis of programs has made significant progress for stack and static data. What about heap data? Given two access expressions at a program point, do they have the same l-value? Given the same access expression at two program points, does it have the same l-value?
38 CS 618 Program Analysis: About These Slides 16/19 Our Solution 1 w = x 2 while (x.data < max) y = z = null w = null { x. = null 3 x = x. } 4 y = x. 5 z = New class of z 6 y = y. 7 z.sum = x.data + y.data x. = x.. = null x... = null x... = null x. = y. = null y.. = y.. = null z. = z. = null y. = y. = null x = y = z = null
39 CS 618 Program Analysis: About These Slides 17/19 Our Solution y = z = null 1 w = x w = null 2 while (x.data < max) { x. = null 3 x = x. } x. = x.. = null x... = null x... = null 4 y = x. x. = y. = null y.. = y.. = null 5 z = New class of z z. = z. = null 6 y = y. y. = y. = null 7 z.sum = x.data + y.data x = y = z = null While loop is not executed even once z x w y Stack p a q b i c f j m Heap d e g h k l n o
40 CS 618 Program Analysis: About These Slides 17/19 Our Solution y = z = null 1 w = x w = null 2 while (x.data < max) { x. = null 3 x = x. } x. = x.. = null x... = null x... = null 4 y = x. x. = y. = null y.. = y.. = null 5 z = New class of z z. = z. = null 6 y = y. y. = y. = null 7 z.sum = x.data + y.data x = y = z = null While loop is not executed even once z x w y Stack p a q b i c f j m Heap d e g h k l n o
41 CS 618 Program Analysis: About These Slides 17/19 Our Solution y = z = null 1 w = x w = null 2 while (x.data < max) { x. = null 3 x = x. } x. = x.. = null x... = null x... = null 4 y = x. x. = y. = null y.. = y.. = null 5 z = New class of z z. = z. = null 6 y = y. y. = y. = null 7 z.sum = x.data + y.data x = y = z = null While loop is not executed even once z x w y Stack p a q b i c f j m Heap d e g h k l n o
42 CS 618 Program Analysis: About These Slides 17/19 Our Solution y = z = null 1 w = x w = null 2 while (x.data < max) { x. = null 3 x = x. } x. = x.. = null x... = null x... = null 4 y = x. x. = y. = null y.. = y.. = null 5 z = New class of z z. = z. = null 6 y = y. y. = y. = null 7 z.sum = x.data + y.data x = y = z = null While loop is not executed even once z x w y Stack p a q b i c f j m Heap d e g h k l n o
43 CS 618 Program Analysis: About These Slides 17/19 Our Solution y = z = null 1 w = x w = null 2 while (x.data < max) { x. = null 3 x = x. } x. = x.. = null x... = null x... = null 4 y = x. x. = y. = null y.. = y.. = null 5 z = New class of z z. = z. = null 6 y = y. y. = y. = null 7 z.sum = x.data + y.data x = y = z = null While loop is not executed even once z x w y Stack p a q b i c f j m Heap d e g h k l n o
44 CS 618 Program Analysis: About These Slides 17/19 Our Solution y = z = null 1 w = x w = null 2 while (x.data < max) { x. = null 3 x = x. } x. = x.. = null x... = null x... = null 4 y = x. x. = y. = null y.. = y.. = null 5 z = New class of z z. = z. = null 6 y = y. y. = y. = null 7 z.sum = x.data + y.data x = y = z = null While loop is not executed even once z x w y Stack p a q b i c f j m Heap d e g h k l n o
45 CS 618 Program Analysis: About These Slides 17/19 Our Solution y = z = null 1 w = x w = null 2 while (x.data < max) { x. = null 3 x = x. } x. = x.. = null x... = null x... = null 4 y = x. x. = y. = null y.. = y.. = null 5 z = New class of z z. = z. = null 6 y = y. y. = y. = null 7 z.sum = x.data + y.data x = y = z = null While loop is not executed even once z x w y Stack p a q b i c f j m Heap d e g h k l n o
46 CS 618 Program Analysis: About These Slides 17/19 Our Solution y = z = null 1 w = x w = null 2 while (x.data < max) { x. = null 3 x = x. } x. = x.. = null x... = null x... = null 4 y = x. x. = y. = null y.. = y.. = null 5 z = New class of z z. = z. = null 6 y = y. y. = y. = null 7 z.sum = x.data + y.data x = y = z = null z x w y Stack While loop is executed once p a q b i c f j m Heap d e g h k l n o
47 CS 618 Program Analysis: About These Slides 17/19 Our Solution y = z = null 1 w = x w = null 2 while (x.data < max) { x. = null 3 x = x. } x. = x.. = null x... = null x... = null 4 y = x. x. = y. = null y.. = y.. = null 5 z = New class of z z. = z. = null 6 y = y. y. = y. = null 7 z.sum = x.data + y.data x = y = z = null z x w y Stack While loop is executed twice p a q b i c f j m Heap d e g h k l n o
48 CS 618 Program Analysis: About These Slides 18/19 Some Observations y = z = null 1 w = x w = null 2 while (x.data < max) { x. = null 3 x = x. } x. = x.. = null x... = null x... = null 4 y = x. x. = y. = null y.. = y.. = null 5 z = New class of z z. = z. = null 6 y = y. y. = y. = null 7 z.sum = x.data + y.data x = y = z = null Node i is live but link a i is nullified z x w y Stack p a q b i c f j m Heap d e g h k l n o
49 CS 618 Program Analysis: About These Slides 18/19 Some Observations y = z = null 1 w = x w = null 2 while (x.data < max) { x. = null 3 x = x. } x. = x.. = null x... = null x... = null 4 y = x. x. = y. = null y.. = y.. = null 5 z = New class of z z. = z. = null 6 y = y. y. = y. = null 7 z.sum = x.data + y.data x = y = z = null New access expressions are created. Can they cause exceptions? z x w y Stack p a q b i c f j m Heap d e g h k l n o
50 CS 618 Program Analysis: About These Slides 19/19 Goals of This Tutorial Main Goal: Explain how to get the modified program Side goals:
51 CS 618 Program Analysis: About These Slides 19/19 Goals of This Tutorial Main Goal: Explain how to get the modified program Side goals: Data Flow Values Acceptable Operations Desired Solutions Practical Algorithms Explain the intuitions Relate them to mathematical rigour Highlight the frontiers
Heap, Variables, References, and Garbage. CS152. Chris Pollett. Oct. 13, 2008.
Heap, Variables, References, and Garbage. CS152. Chris Pollett. Oct. 13, 2008. Outline. Dynamic Allocation. Variables and Constants. Aliases and Problems. Garbage. Introduction. On Wednesday, we were talking
More informationGarbage Collection. Steven R. Bagley
Garbage Collection Steven R. Bagley Reference Counting Counts number of pointers to an Object deleted when the count hits zero Eager deleted as soon as it is finished with Problem: Circular references
More informationSustainable Memory Use Allocation & (Implicit) Deallocation (mostly in Java)
COMP 412 FALL 2017 Sustainable Memory Use Allocation & (Implicit) Deallocation (mostly in Java) Copyright 2017, Keith D. Cooper & Zoran Budimlić, all rights reserved. Students enrolled in Comp 412 at Rice
More informationContents. 8-1 Copyright (c) N. Afshartous
Contents 1. Introduction 2. Types and Variables 3. Statements and Control Flow 4. Reading Input 5. Classes and Objects 6. Arrays 7. Methods 8. Scope and Lifetime 9. Utility classes 10 Introduction to Object-Oriented
More informationExample. program sort; var a : array[0..10] of integer; procedure readarray; : function partition (y, z :integer) :integer; var i, j,x, v :integer; :
Runtime Environment Relationship between names and data objects (of target machine) Allocation & de-allocation is managed by run time support package Each execution of a procedure is an activation of the
More informationLecture 14. No in-class files today. Homework 7 (due on Wednesday) and Project 3 (due in 10 days) posted. Questions?
Lecture 14 No in-class files today. Homework 7 (due on Wednesday) and Project 3 (due in 10 days) posted. Questions? Friday, February 11 CS 215 Fundamentals of Programming II - Lecture 14 1 Outline Static
More informationCompiler Construction
Compiler Construction Lecture 18: Code Generation V (Implementation of Dynamic Data Structures) Thomas Noll Lehrstuhl für Informatik 2 (Software Modeling and Verification) noll@cs.rwth-aachen.de http://moves.rwth-aachen.de/teaching/ss-14/cc14/
More informationRun-Time Environments/Garbage Collection
Run-Time Environments/Garbage Collection Department of Computer Science, Faculty of ICT January 5, 2014 Introduction Compilers need to be aware of the run-time environment in which their compiled programs
More informationCMSC 330: Organization of Programming Languages
CMSC 330: Organization of Programming Languages Memory Management and Garbage Collection CMSC 330 - Spring 2013 1 Memory Attributes! Memory to store data in programming languages has the following lifecycle
More informationCompiler Construction
Compiler Construction Thomas Noll Software Modeling and Verification Group RWTH Aachen University https://moves.rwth-aachen.de/teaching/ss-16/cc/ Recap: Static Data Structures Outline of Lecture 18 Recap:
More informationCS558 Programming Languages
CS558 Programming Languages Fall 2016 Lecture 3a Andrew Tolmach Portland State University 1994-2016 Formal Semantics Goal: rigorous and unambiguous definition in terms of a wellunderstood formalism (e.g.
More informationRun-time Environments - 3
Run-time Environments - 3 Y.N. Srikant Computer Science and Automation Indian Institute of Science Bangalore 560 012 NPTEL Course on Principles of Compiler Design Outline of the Lecture n What is run-time
More informationCMSC 330: Organization of Programming Languages
CMSC 330: Organization of Programming Languages Memory Management and Garbage Collection CMSC 330 Spring 2017 1 Memory Attributes Memory to store data in programming languages has the following lifecycle
More informationLecture 13: Garbage Collection
Lecture 13: Garbage Collection COS 320 Compiling Techniques Princeton University Spring 2016 Lennart Beringer/Mikkel Kringelbach 1 Garbage Collection Every modern programming language allows programmers
More informationRuntime. The optimized program is ready to run What sorts of facilities are available at runtime
Runtime The optimized program is ready to run What sorts of facilities are available at runtime Compiler Passes Analysis of input program (front-end) character stream Lexical Analysis token stream Syntactic
More informationHeap Reference Analysis Using Access Graphs
Heap Reference Analysis Using Access Graphs UDAY P. KHEDKER, AMITABHA SANYAL and AMEY KARKARE Department of Computer Science & Engg., IIT Bombay. Despite significant progress in the theory and practice
More informationCS 536 Introduction to Programming Languages and Compilers Charles N. Fischer Lecture 11
CS 536 Introduction to Programming Languages and Compilers Charles N. Fischer Lecture 11 CS 536 Spring 2015 1 Handling Overloaded Declarations Two approaches are popular: 1. Create a single symbol table
More informationCS558 Programming Languages
CS558 Programming Languages Winter 2017 Lecture 4a Andrew Tolmach Portland State University 1994-2017 Semantics and Erroneous Programs Important part of language specification is distinguishing valid from
More informationCMSC 330: Organization of Programming Languages. Memory Management and Garbage Collection
CMSC 330: Organization of Programming Languages Memory Management and Garbage Collection CMSC330 Fall 2018 1 Memory Attributes Memory to store data in programming languages has the following lifecycle
More informationProgramming Language Implementation
A Practical Introduction to Programming Language Implementation 2014: Week 10 Garbage Collection College of Information Science and Engineering Ritsumeikan University 1 review of last week s topics dynamic
More informationItem 18: Implement the Standard Dispose Pattern
Item 18: Implement the Standard Dispose Pattern 1 Item 18: Implement the Standard Dispose Pattern We ve discussed the importance of disposing of objects that hold unmanaged resources. Now it s time to
More informationQuantifying the Performance of Garbage Collection vs. Explicit Memory Management
Quantifying the Performance of Garbage Collection vs. Explicit Memory Management Matthew Hertz Canisius College Emery Berger University of Massachusetts Amherst Explicit Memory Management malloc / new
More informationRun-time Environments -Part 3
Run-time Environments -Part 3 Y.N. Srikant Computer Science and Automation Indian Institute of Science Bangalore 560 012 NPTEL Course on Compiler Design Outline of the Lecture Part 3 What is run-time support?
More informationhttps://lambda.mines.edu A pointer is a value that indicates location in memory. When we change the location the pointer points to, we say we assign the pointer a value. When we look at the data the pointer
More informationAcknowledgements These slides are based on Kathryn McKinley s slides on garbage collection as well as E Christopher Lewis s slides
Garbage Collection Last time Compiling Object-Oriented Languages Today Motivation behind garbage collection Garbage collection basics Garbage collection performance Specific example of using GC in C++
More informationProgrammer Directed GC for C++ Michael Spertus N2286= April 16, 2007
Programmer Directed GC for C++ Michael Spertus N2286=07-0146 April 16, 2007 Garbage Collection Automatically deallocates memory of objects that are no longer in use. For many popular languages, garbage
More informationG Programming Languages - Fall 2012
G22.2110-003 Programming Languages - Fall 2012 Lecture 2 Thomas Wies New York University Review Last week Programming Languages Overview Syntax and Semantics Grammars and Regular Expressions High-level
More informationLecture 15 Garbage Collection
Lecture 15 Garbage Collection I. Introduction to GC -- Reference Counting -- Basic Trace-Based GC II. Copying Collectors III. Break Up GC in Time (Incremental) IV. Break Up GC in Space (Partial) Readings:
More informationLANGUAGE RUNTIME NON-VOLATILE RAM AWARE SWAPPING
Technical Disclosure Commons Defensive Publications Series July 03, 2017 LANGUAGE RUNTIME NON-VOLATILE AWARE SWAPPING Follow this and additional works at: http://www.tdcommons.org/dpubs_series Recommended
More informationManual Allocation. CS 1622: Garbage Collection. Example 1. Memory Leaks. Example 3. Example 2 11/26/2012. Jonathan Misurda
Manual llocation Dynamic memory allocation is an obvious necessity in a programming environment. S 1622: Garbage ollection Many programming languages expose some functions or keywords to manage runtime
More informationGarbage Collection. Akim D le, Etienne Renault, Roland Levillain. May 15, CCMP2 Garbage Collection May 15, / 35
Garbage Collection Akim Demaille, Etienne Renault, Roland Levillain May 15, 2017 CCMP2 Garbage Collection May 15, 2017 1 / 35 Table of contents 1 Motivations and Definitions 2 Reference Counting Garbage
More informationCS 241 Honors Memory
CS 241 Honors Memory Ben Kurtovic Atul Sandur Bhuvan Venkatesh Brian Zhou Kevin Hong University of Illinois Urbana Champaign February 20, 2018 CS 241 Course Staff (UIUC) Memory February 20, 2018 1 / 35
More informationGarbage Collection (1)
Garbage Collection (1) Advanced Operating Systems Lecture 7 This work is licensed under the Creative Commons Attribution-NoDerivatives 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nd/4.0/
More information6.172 Performance Engineering of Software Systems Spring Lecture 9. P after. Figure 1: A diagram of the stack (Image by MIT OpenCourseWare.
6.172 Performance Engineering of Software Systems Spring 2009 Lecture 9 MIT OpenCourseWare Dynamic Storage Allocation Stack allocation: LIFO (last-in-first-out) Array and pointer A used unused P before
More informationSpace Efficient Conservative Garbage Collection
RETROSPECTIVE: Space Efficient Conservative Garbage Collection Hans-J. Boehm HP Laboratories 1501 Page Mill Rd. MS 1138 Palo Alto, CA, 94304, USA Hans.Boehm@hp.com ABSTRACT Both type-accurate and conservative
More informationManaged runtimes & garbage collection. CSE 6341 Some slides by Kathryn McKinley
Managed runtimes & garbage collection CSE 6341 Some slides by Kathryn McKinley 1 Managed runtimes Advantages? Disadvantages? 2 Managed runtimes Advantages? Reliability Security Portability Performance?
More informationHeap Management. Heap Allocation
Heap Management Heap Allocation A very flexible storage allocation mechanism is heap allocation. Any number of data objects can be allocated and freed in a memory pool, called a heap. Heap allocation is
More informationStructure of Programming Languages Lecture 10
Structure of Programming Languages Lecture 10 CS 6636 4536 Spring 2017 CS 6636 4536 Lecture 10: Classes... 1/23 Spring 2017 1 / 23 Outline 1 1. Types Type Coercion and Conversion Type Classes, Generics,
More informationCS558 Programming Languages
CS558 Programming Languages Fall 2017 Lecture 3a Andrew Tolmach Portland State University 1994-2017 Binding, Scope, Storage Part of being a high-level language is letting the programmer name things: variables
More informationIn Java we have the keyword null, which is the value of an uninitialized reference type
+ More on Pointers + Null pointers In Java we have the keyword null, which is the value of an uninitialized reference type In C we sometimes use NULL, but its just a macro for the integer 0 Pointers are
More informationHabanero Extreme Scale Software Research Project
Habanero Extreme Scale Software Research Project Comp215: Garbage Collection Zoran Budimlić (Rice University) Adapted from Keith Cooper s 2014 lecture in COMP 215. Garbage Collection In Beverly Hills...
More informationManaged runtimes & garbage collection
Managed runtimes Advantages? Managed runtimes & garbage collection CSE 631 Some slides by Kathryn McKinley Disadvantages? 1 2 Managed runtimes Portability (& performance) Advantages? Reliability Security
More informationRun-time Environments -Part 1
Run-time Environments -Part 1 Y.N. Srikant Computer Science and Automation Indian Institute of Science Bangalore 560 012 NPTEL Course on Compiler Design Outline of the Lecture Part 1 What is run-time support?
More informationEstimating the Impact of Heap Liveness Information on Space Consumption in Java
Estimating the Impact of Heap Liveness Information on Space Consumption in Java by R. Shaham, E. Kolodner and M. Sagiv first presented at ISSM'02 presentation: Adrian Moos Contents what is this about?
More informationName, Scope, and Binding. Outline [1]
Name, Scope, and Binding In Text: Chapter 3 Outline [1] Variable Binding Storage bindings and lifetime Type bindings Type Checking Scope Lifetime vs. Scope Referencing Environments N. Meng, S. Arthur 2
More informationDeallocation Mechanisms. User-controlled Deallocation. Automatic Garbage Collection
Deallocation Mechanisms User-controlled Deallocation Allocating heap space is fairly easy. But how do we deallocate heap memory no longer in use? Sometimes we may never need to deallocate! If heaps objects
More informationLecture Notes on Garbage Collection
Lecture Notes on Garbage Collection 15-411: Compiler Design Frank Pfenning Lecture 21 November 4, 2014 These brief notes only contain a short overview, a few pointers to the literature with detailed descriptions,
More informationAbout These Slides. GDFA: Generic Data Flow Analyser for GCC. Part 1. Copyright. Outline. Uday Khedker
GDFA: Generic Data Flow Analyser for GCC Uday Khedker (www.cse.iitb.ac.in/ uday) Department of Computer Science and Engineering, Indian Institute of Technology, Bombay Part 1 About These Slides August
More informationCS 345. Garbage Collection. Vitaly Shmatikov. slide 1
CS 345 Garbage Collection Vitaly Shmatikov slide 1 Major Areas of Memory Static area Fixed size, fixed content, allocated at compile time Run-time stack Variable size, variable content (activation records)
More informationCS61C : Machine Structures
inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture 7 More Memory Management CS 61C L07 More Memory Management (1) 2004-09-15 Lecturer PSOE Dan Garcia www.cs.berkeley.edu/~ddgarcia Star Wars
More informationGarbage Collection. Hwansoo Han
Garbage Collection Hwansoo Han Heap Memory Garbage collection Automatically reclaim the space that the running program can never access again Performed by the runtime system Two parts of a garbage collector
More informationAutonomous Garbage Collection: Resolve Memory
Autonomous Garbage Collection: Resolve Memory Leaks In Long Running Server Applications Brian Willard willabr@mail.northgrum.com Ophir Frieder ophir@csam.iit.edu Electronics and Systems Integration Division
More informationRun-time Environments - 2
Run-time Environments - 2 Y.N. Srikant Computer Science and Automation Indian Institute of Science Bangalore 560 012 NPTEL Course on Principles of Compiler Design Outline of the Lecture n What is run-time
More informationPointers II. Class 31
Pointers II Class 31 Compile Time all of the variables we have seen so far have been declared at compile time they are written into the program code you can see by looking at the program how many variables
More informationLecture 7: Binding Time and Storage
Lecture 7: Binding Time and Storage COMP 524 Programming Language Concepts Stephen Olivier February 5, 2009 Based on notes by A. Block, N. Fisher, F. Hernandez-Campos, and D. Stotts Goal of Lecture The
More informationExploiting the Behavior of Generational Garbage Collector
Exploiting the Behavior of Generational Garbage Collector I. Introduction Zhe Xu, Jia Zhao Garbage collection is a form of automatic memory management. The garbage collector, attempts to reclaim garbage,
More informationCS61C : Machine Structures
inst.eecs.berkeley.edu/~cs61c/su06 CS61C : Machine Structures Lecture #6: Memory Management CS 61C L06 Memory Management (1) 2006-07-05 Andy Carle Memory Management (1/2) Variable declaration allocates
More information1. Mark-and-Sweep Garbage Collection
Due: Tuesday, April 21, 2015. 11:59pm (no extensions). What to submit: A tar ball containing the files: Slide.java, slide.png or slide.pdf with your slide, benchmark.template, and any file(s) containing
More informationThe issues. Programming in C++ Common storage modes. Static storage in C++ Session 8 Memory Management
Session 8 Memory Management The issues Dr Christos Kloukinas City, UoL http://staff.city.ac.uk/c.kloukinas/cpp (slides originally produced by Dr Ross Paterson) Programs manipulate data, which must be stored
More informationMEMORY MANAGEMENT HEAP, STACK AND GARBAGE COLLECTION
MEMORY MANAGEMENT HEAP, STACK AND GARBAGE COLLECTION 2 1. What is the Heap Size: 2 2. What is Garbage Collection: 3 3. How are Java objects stored in memory? 3 4. What is the difference between stack and
More informationCSE 100: C++ TEMPLATES AND ITERATORS
CSE 100: C++ TEMPLATES AND ITERATORS Announcements iclickers: Please register at ted.ucsd.edu. Start ASAP!! For PA1 (Due next week). 10/6 grading and 10/8 regrading How is Assignment 1 going? A. I haven
More informationProcedure and Function Calls, Part II. Comp 412 COMP 412 FALL Chapter 6 in EaC2e. target code. source code Front End Optimizer Back End
COMP 412 FALL 2017 Procedure and Function Calls, Part II Comp 412 source code IR Front End Optimizer Back End IR target code Copyright 2017, Keith D. Cooper & Linda Torczon, all rights reserved. Students
More informationProject. there are a couple of 3 person teams. a new drop with new type checking is coming. regroup or see me or forever hold your peace
Project there are a couple of 3 person teams regroup or see me or forever hold your peace a new drop with new type checking is coming using it is optional 1 Compiler Architecture source code Now we jump
More informationLecture Notes on Garbage Collection
Lecture Notes on Garbage Collection 15-411: Compiler Design André Platzer Lecture 20 1 Introduction In the previous lectures we have considered a programming language C0 with pointers and memory and array
More informationMemory Allocation. Static Allocation. Dynamic Allocation. Dynamic Storage Allocation. CS 414: Operating Systems Spring 2008
Dynamic Storage Allocation CS 44: Operating Systems Spring 2 Memory Allocation Static Allocation (fixed in size) Sometimes we create data structures that are fixed and don t need to grow or shrink. Dynamic
More informationStorage. Outline. Variables and updating. Copy vs. Ref semantics Lifetime. Dangling References Garbage collection
Storage 1 Variables and updating Outline Copy vs. Ref semantics Lifetime Local and global variables Heap variables Persistent variables Dangling References Garbage collection 2 Variables and Updating Variable:
More informationAdvanced Programming & C++ Language
Advanced Programming & C++ Language ~6~ Introduction to Memory Management Ariel University 2018 Dr. Miri (Kopel) Ben-Nissan Stack & Heap 2 The memory a program uses is typically divided into four different
More informationStorage. Outline. Variables and Updating. Composite Variables. Storables Lifetime : Programming Languages. Course slides - Storage
Storage 1 Variables and Updating Outline Composite Variables Total and selective updating Array variables Storables Lifetime Local and global variables Heap variables Persistent variables Garbage collection
More informationJVM Troubleshooting MOOC: Troubleshooting Memory Issues in Java Applications
JVM Troubleshooting MOOC: Troubleshooting Memory Issues in Java Applications Poonam Parhar JVM Sustaining Engineer Oracle Lesson 1 HotSpot JVM Memory Management Poonam Parhar JVM Sustaining Engineer Oracle
More informationCS 4120 Lecture 37 Memory Management 28 November 2011 Lecturer: Andrew Myers
CS 4120 Lecture 37 Memory Management 28 November 2011 Lecturer: Andrew Myers Heap allocation is a necessity for modern programming tasks, and so is automatic reclamation of heapallocated memory. However,
More informationCS201 Some Important Definitions
CS201 Some Important Definitions For Viva Preparation 1. What is a program? A program is a precise sequence of steps to solve a particular problem. 2. What is a class? We write a C++ program using data
More informationQualifying Exam in Programming Languages and Compilers
Qualifying Exam in Programming Languages and Compilers University of Wisconsin Fall 1991 Instructions This exam contains nine questions, divided into two parts. All students taking the exam should answer
More informationMemory Allocation III
Memory Allocation III CSE 351 Autumn 2016 Instructor: Justin Hsia Teaching Assistants: Chris Ma Hunter Zahn John Kaltenbach Kevin Bi Sachin Mehta Suraj Bhat Thomas Neuman Waylon Huang Xi Liu Yufang Sun
More informationMemory Management. Memory Management... Memory Management... Interface to Dynamic allocation
CSc 453 Compilers and Systems Software 24 : Garbage Collection Introduction Department of Computer Science University of Arizona collberg@gmail.com Copyright c 2009 Christian Collberg Dynamic Memory Management
More informationQ1: /8 Q2: /30 Q3: /30 Q4: /32. Total: /100
ECE 2035(A) Programming for Hardware/Software Systems Fall 2013 Exam Three November 20 th 2013 Name: Q1: /8 Q2: /30 Q3: /30 Q4: /32 Total: /100 1/10 For functional call related questions, let s assume
More informationCSC 1600 Memory Layout for Unix Processes"
CSC 16 Memory Layout for Unix Processes" 1 Lecture Goals" Behind the scenes of running a program" Code, executable, and process" Memory layout for UNIX processes, and relationship to C" : code and constant
More informationOne-Slide Summary. Lecture Outine. Automatic Memory Management #1. Why Automatic Memory Management? Garbage Collection.
Automatic Memory Management #1 One-Slide Summary An automatic memory management system deallocates objects when they are no longer used and reclaims their storage space. We must be conservative and only
More informationStackVsHeap SPL/2010 SPL/20
StackVsHeap Objectives Memory management central shared resource in multiprocessing RTE memory models that are used in Java and C++ services for Java/C++ programmer from RTE (JVM / OS). Perspectives of
More informationPrinciples of Programming Languages Topic: Scope and Memory Professor Louis Steinberg Fall 2004
Principles of Programming Languages Topic: Scope and Memory Professor Louis Steinberg Fall 2004 CS 314, LS,BR,LTM: Scope and Memory 1 Review Functions as first-class objects What can you do with an integer?
More informationShort Notes of CS201
#includes: Short Notes of CS201 The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with < and > if the file is a system
More informationLecture Notes on Memory Layout
Lecture Notes on Memory Layout 15-122: Principles of Imperative Computation Frank Pfenning André Platzer Lecture 11 1 Introduction In order to understand how programs work, we can consider the functions,
More informationProposal to Acknowledge that Garbage Collection for C++ is Possible X3J16/ WG21/N0932. Bjarne Stroustrup. AT&T Research.
Proposal to Acknowledge that Garbage Collection for C++ is Possible X3J16/96-0114 WG21/N0932 Bjarne Stroustrup AT&T Research Murray Hill New Jersey 07974 USA The ARM, "The C++ Programming Language (2nd
More informationCS201 - Introduction to Programming Glossary By
CS201 - Introduction to Programming Glossary By #include : The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with
More informationCPSC 213. Introduction to Computer Systems. Instance Variables and Dynamic Allocation. Unit 1c
CPSC 213 Introduction to Computer Systems Unit 1c Instance Variables and Dynamic Allocation 1 Reading For Next 3 Lectures Companion 2.4.4-2.4.5 Textbook Structures, Dynamic Memory Allocation, Understanding
More informationCS162 - POINTERS. Lecture: Pointers and Dynamic Memory
CS162 - POINTERS Lecture: Pointers and Dynamic Memory What are pointers Why dynamically allocate memory How to dynamically allocate memory What about deallocation? Walk thru pointer exercises 1 CS162 -
More informationCA341 - Comparative Programming Languages
CA341 - Comparative Programming Languages David Sinclair Dynamic Data Structures Generally we do not know how much data a program will have to process. There are 2 ways to handle this: Create a fixed data
More informationData Structure Series
Data Structure Series This series is actually something I started back when I was part of the Sweet.Oblivion staff, but then some things happened and I was no longer able to complete it. So now, after
More informationCS 430 Spring Mike Lam, Professor. Data Types and Type Checking
CS 430 Spring 2015 Mike Lam, Professor Data Types and Type Checking Type Systems Type system Rules about valid types, type compatibility, and how data values can be used Benefits of a robust type system
More informationGarbage Collection Techniques
Garbage Collection Techniques Michael Jantz COSC 340: Software Engineering 1 Memory Management Memory Management Recognizing when allocated objects are no longer needed Deallocating (freeing) the memory
More informationLecture 7 More Memory Management Slab Allocator. Slab Allocator
CS61C L07 More Memory Management (1) inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture 7 More Memory Management 2006-09-13 Lecturer SOE Dan Garcia www.cs.berkeley.edu/~ddgarcia Unbox problems
More informationMemory Usage in Programs
Memory Usage in Programs ECE2036 Lecture 4 ECE2036 Memory Usage in Programs Spring 2016 1 / 11 Memory Usage in Programs The way that memory is assigned to your program is fundamental to understanding how
More informationMemory Allocation III
Memory Allocation III CSE 351 Spring 2017 Instructor: Ruth Anderson Teaching Assistants: Dylan Johnson Kevin Bi Linxing Preston Jiang Cody Ohlsen Yufang Sun Joshua Curtis Administrivia Homework 5 Due Wed
More informationCSE 307: Principles of Programming Languages
CSE 307: Principles of Programming Languages Variables and Constants R. Sekar 1 / 22 Topics 2 / 22 Variables and Constants Variables are stored in memory, whereas constants need not be. Value of variables
More informationCPSC 213. Introduction to Computer Systems. Winter Session 2017, Term 2. Unit 1c Jan 24, 26, 29, 31, and Feb 2
CPSC 213 Introduction to Computer Systems Winter Session 2017, Term 2 Unit 1c Jan 24, 26, 29, 31, and Feb 2 Instance Variables and Dynamic Allocation Overview Reading Companion: Reference 2.4.4-5 Textbook:
More informationI J C S I E International Science Press
Vol. 5, No. 2, December 2014, pp. 53-56 I J C S I E International Science Press Tolerating Memory Leaks at Runtime JITENDER SINGH YADAV, MOHIT YADAV, KIRTI AZAD AND JANPREET SINGH JOLLY CSE B-tech 4th
More informationACM Trivia Bowl. Thursday April 3 rd (two days from now) 7pm OLS 001 Snacks and drinks provided All are welcome! I will be there.
#1 ACM Trivia Bowl Thursday April 3 rd (two days from now) 7pm OLS 001 Snacks and drinks provided All are welcome! I will be there. If you are in one of the top three teams, I will give you one point of
More informationRun-time Environments
Run-time Environments Status We have so far covered the front-end phases Lexical analysis Parsing Semantic analysis Next come the back-end phases Code generation Optimization Register allocation Instruction
More informationRun-time Environments
Run-time Environments Status We have so far covered the front-end phases Lexical analysis Parsing Semantic analysis Next come the back-end phases Code generation Optimization Register allocation Instruction
More informationAdvances in Programming Languages: Regions
Advances in Programming Languages: Regions Allan Clark and Stephen Gilmore The University of Edinburgh February 22, 2007 Introduction The design decision that memory will be managed on a per-language basis
More informationo Code, executable, and process o Main memory vs. virtual memory
Goals for Today s Lecture Memory Allocation Prof. David August COS 217 Behind the scenes of running a program o Code, executable, and process o Main memory vs. virtual memory Memory layout for UNIX processes,
More information