ch11 - Programming Languages Memory Management Chapter 11 1...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Programming Languages Memory Management Chapter 11
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 Definitions Memory management: the process of binding values to memory locations. The memory accessible to a program is its address space, represented as a set of values {0, 1, …, n}. The numbers represent memory locations. These are logical addresses – do not usually correspond to physical addresses at runtime. The exact size and organization of the address space depends on the computer, the operating system and the programming language being used.
Background image of page 2
3 Runtime memory management is an important part of program meaning. The language run-time system creates & deletes stack frames, creates & deletes dynamically allocated heap objects – in cooperation with the operating system Whether done automatically (as in Java or Python), or partially by the programmer (as in C/C++), dynamic memory management is an important part of programming language design.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 Review Definitions Method : any subprogram (function, procedure, subroutine) – depends on language terminology. Environment of an active method : the variables it can currently access plus their addresses (a set of ordered pairs) State of an active method: variable/value pairs
Background image of page 4
5 Three Categories of Memory (for Data Store) Static : storage requirements are known prior to run time; lifetime is the entire program execution Run-time stack : memory associated with active functions Structured as stack frames (activation records) Heap: dynamically allocated storage; the least organized and most dynamic storage area
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
6 Static Data Memory Simplest type of memory to manage. Consists of anything that can be completely determined at compile time; e.g. , global variables, constants (perhaps), code. Characteristics: Storage requirements known prior to execution Size of static storage area is constant throughout execution
Background image of page 6
7 Run-Time Stack The stack is a contiguous memory region that grows and shrinks as a program runs. Its purpose: to support method calls It grows (storage is allocated) when the activation record (or stack frame ) is pushed on the stack at the time a method is called (activated). It shrinks when the method terminates and storage is de-allocated.
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
8 Run-Time Stack The stack frame has storage for local variables, parameters, and return linkage. The size and structure of a stack frame is known at compile time, but actual contents and time of allocation is unknown until runtime. How is variable lifetime affected by stack management techniques?
Background image of page 8
9 Heap Memory Heap objects are allocated/deallocated dynamically as the program runs (not associated with specific event such as function entry/exit). The kind of data found on the heap
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/21/2010 for the course CS 424 taught by Professor Weisskopf during the Spring '10 term at University of Alabama - Huntsville.

Page1 / 69

ch11 - Programming Languages Memory Management Chapter 11 1...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online