Memory Model & Pointer Problems

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/13

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 4:42 AM on 5/4/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

14 Terms

1
New cards

Text (Code)

machine instructions, read-only, entire program lifetime

2
New cards

Data

initialized globals/statics (int x = 5; at global scope)

3
New cards

BSS

uninitialized globals/statics, auto-zeroed by OS

4
New cards

Heap

dynamic allocation (malloc/new), grows upward, you manage lifetime

5
New cards

Stack

local vars + function args, grows downward, auto-managed

6
New cards

Dangling Pointer

A pointer that points to memory that has already been freed. Accessing it is undefined behavior and a security risk.

7
New cards

Lost Heap Variable (Memory Leak)

A heap allocation that can no longer be reached — no pointer points to it. Cannot be freed. Accumulates = memory leak.

8
New cards

Array Out of Bounds

Out-of-bounds writes are the root cause of buffer overflow attacks.

9
New cards

Unchecked open()

returns -1 on failure. Must check before using fd.

10
New cards

Unchecked read()

read() returns bytes read. Negative = error. Fewer bytes = partial read.

11
New cards

Invalid len to malloc

If len is negative or too large, conversion to unsigned size_t can cause a huge/incorrect allocation request.

12
New cards

Unchecked malloc()

malloc() returns NULL on failure. Must check before dereferencing.

13
New cards

Missing null terminator

Allocating len bytes for a string but needing len+1 for '\0'.

14
New cards

Missing free()/close()

Not freeing memory or closing file descriptors = resource leaks.