Module 6 - Memory Allocation and LayoutModule Overview
./../../private/data/6/header.jpg
./../../private/data/6/header2.jpg
./../../private/data/6/header3.jpg
×
1.) C++ is not the C Language -- Course Introduction
2.) C++ Batteries Included - STL and GDB Debugging with the STL
3.) Functions 1: Making our code more modular | GDB and Functions
4.) Input and Output
5.) C++: Thinking about memory
6.) Memory Allocation and Layout
7.) Arrays, Splines, and SFML Library Introduction
☰ Select another Module

Audio/Video Recording

...Commented Code Samples (if any)

For now I am linking code samples here: Github Code Repository for the course
...

Additional Resources


Slides


(Graded) In-Class Activity link

  • In-Class Activity Link
    • This is graded, and only your first response is graded
    • This is an evaluation of what was learned in lecture.
    • Due one week from when the lecture takes place

Module Content

Module Overview

In this module we take another look at memory allocation and layout!


Module Outline

  • Lecture outline
    • Stack Memory
    • Heap Memory
    • Static Memory

Commentary

Prev
(Optional Notes)

Commentary

Operating system view of a Process

  • A program is segmented into several regions of memory.
  • TODO: Insert picture of process here with Stack/Heap/Data/Text sections.

Stack Memory

  • Automatically allocated data structure
  • Typically used for short-lived data.
  • Any time we create a variable, it is placed on the stack.
  • Allocating

Heap Memory

  • Heap/Free Store Data Structure
  • Used for longer lived and larger memory allocations.
  • More expensive to allocate, as we have to request memory from operating system (requires a context switch to the system)
    • Memory has to be searched for (either from the 'heap/free store' data structure, or otherwise allocated in the process)

Please do not redistribute or host any materials without e-mailing me first. I generally am happy to share the latest .pdf or slide presentation with those who ask. Thank you for your time!