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
8.) Building Data Structures -- Structs and Linked Lists
9.) Physical Structure of a C++ Project
10.) No Class
11.) Graphics Applications, Textures, Images, Sprites, and 2D Arrays
12.) Object-Oriented Programming 1
13.) Object-Oriented Programming 2
14.) Object-Oriented Programming 3 - Composition & Inheritance
15.) Binary Tree Data Structure
16.) C++ Templates - Code Generation and Generics
17.) Smart Pointers and Quad Trees
18.) Iterators and Algorithms
19.) Concurrency and Threading
20.) Final Project Discussion
21.) Review/Functors/Lambda's/
22.) Graphs
23.) Holiday no class
24.) LValues, RValues, and Move Semantics
25.) Advanced Topic 1 - Scripting with C++ using Pybind11 and Lua
☰ 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!