This course provides a comprehensive exploration of how memory interacts with programming languages. Beginning with the fundamentals of system memory hierarchy, students learn essential concepts like pointers and pointer arithmetic. The course delves into dynamic memory allocation, highlighting ownership principles to manage memory effectively. Fundamental object-oriented topics such as copy constructors and move semantics are covered, addressing the crucial Rule of Three/Five for robust memory management. Additionally, advanced techniques involving smart pointers are introduced to enhance memory safety. The course culminates in a hands-on project to apply learned skills in real-world scenarios.
Overview
Syllabus
- Memory Fundamentals and the System Memory Hierarchy
- Explore C++ memory structure, pointers, addresses, the system memory hierarchy, caching, and GDB debugger use for efficient programming and troubleshooting.
- Pointers and Pointer Arithmetic
- Learn C++ pointers: how they store memory addresses, enable direct data manipulation, perform pointer arithmetic, and avoid common errors like null, dangling, and out-of-bounds pointers.
- Dynamic Memory Allocation (Heap) and Ownership
- Learn dynamic memory allocation in C++: using new/delete, preventing leaks, double deletion, and dangling pointers, and managing ownership with best practices and smart pointers.
- Copy Constructors, Move Semantics, and the Rule of Three/Five
- Learn C++ copy constructors, move semantics, and the Rule of Three/Five. Master memory management, deep vs. shallow copy, and RAII for safe, efficient resource handling.
- Smart Pointers and Advanced Memory Management
- Master C++ smart pointers for safer, modern memory management: exclusive and shared ownership, avoiding leaks, breaking cycles, and refactoring legacy code using unique, shared, and weak pointers.
- Memory BOT
- In this project, you will build a simple, terminal-based chatbot that creates a dialogue where users can ask questions about some aspects of memory management in C++ via a terminal.
Taught by
Aspen Olmsted