class: title # Address Spaces & Memory ## CSC 213 – September 11, 2026 --- # Agenda for Today 1. Department Events 2. Upcoming Work 3. Assignment Discussion: Ngram Generator 4. Memory Errors & Address Spaces 5. Wrap Up --- # Department Events ## CS Table: Bring Your Own Tech/Society News .indent[ Tuesday, September 15th at noon in the CS Commons ] *To receive a token, send an email to let me know you attended no more than 48 hours after the event.* --- class: section, blue # Upcoming Work --- # Assignment 2: Sorted List **Due:** Monday, September 14th by 11:59pm **Late Deadline:** Wednesday, September 16th at 10:00am Let's look at a demo of a complete assignment first. ## Questions *None so far.* --- # Shell Lab **Due:** Wednesday, September 16th by 11:59pm **Late Deadline:** Monday, September 21st by 11:59pm ## Questions *None so far.* --- class: section, green # Assignment Discussion:
Ngram Generator --- class: section, blue # Memory Errors & Address Spaces --- # Discussion: Memory Errors For each type of memory error, answer the following questions: 1. What causes the error? 2. What happens when the error occurs? Consider the immediate consequences and any longer-term effects. -- ## Memory Errors - Invalid Pointer Write - Buffer Overflow - Uninitialized Read - Memory Leak - Dangling Pointer Read/Write - Double/Invalid Free *Start by thinking of answers on your own. I will let you know when to start discussion.* --- # Address Sanitizer Compile programs with Address Sanitizer to detect many memory errors. ## Instructions Compile with the option `-fsanitize=address`, for example: ``` clang -fsanitize=address -o program program.c ``` or in a `Makefile`: ```Makefile CFLAGS := -g -fsanitize=address ``` Run the program as usual. If Address Sanitizer detects an issue, it will interrupt the program and print an error message. --- class: section, gray # Address Spaces (delayed until next class) --- class: section, blue # Wrap Up --- # Reminders ## Upcoming Deadlines - **Sorted List Assignment:** due Monday, or Wednesday morning with a token - **Shell Lab:** due Wednesday, or the following Monday with a token ## Need help? Use your resources! - Book an appointment during office hours - Attend mentor office hours (Sunday from 3–5pm is next) - Review slides, readings, and other course resources - Use tools like `gdb` and AddressSanitizer to catch and diagnose issues ## Reading - **Mechanism: Address Translation** (OSTEP, Chapter 15) - **Paging: Introduction** (OSTEP, Chapter 18)