Lecture 5/6: Dynamic Memory


May 6, 2020

đź“‚Associated files

Dynamic Memory

CS 106B: Programming Abstractions

Spring 2020, Stanford University Computer Science Department

Lecturers: Chris Gregg and Julie Zelenski

An image of Batman and Robin, the 'dynamic duo'


Slide 2

Announcements


Slide 3

Today's Goals:


Slide 4

Dynamic Memory Allocation


Slide 5

Dynamic Memory Allocation: Motivation


Slide 6

Dynamic Memory Allocation: the new keyword


Slide 7

Arrays -vs- Vectors


Slide 8

Dynamic Memory Allocation: under the hood


Slide 9

Buffer Overflow

A New York Times front page from Friday, November 4, 1988. The headline story is titled, 'Virus in Military Computers Disrupts Systems Nationwide'

An Information Week Magazine cover showing Robert Morris, Jr., the first person to be convicted of a computer crime in the U.S.


Slide 10

Dynamic Memory Allocation: delete


Slide 11

The class destructor function


Slide 12

Thought experiment: the scary world without dynamic memory