
Fix memory bugs in C by using free debugging tools, exploring defective code, and correcting memory management issues through hands-on lessons and a final coding challenge.
Install and configure Windows Subsystem for Linux and Valgrind to find memory errors in C, using gcc, make, Ubuntu, and VS code.
Identify and fix uninitialized values in C by compiling with make, running with valgrind, and initializing variables (often to NULL) to ensure reliable, portable behavior.
Discover how invalid reads cause runtime errors in C by using Valgrind to identify memory access issues, then fix heap and stack misuse, improper frees, and null-terminated string handling.
Identify and fix invalid writes in C using Valgrind, diagnosing stack smashing and buffer overruns, then apply size-aware buffer and copy fixes and proper file handling.
Trace invalid frees in C with Valgrind, diagnose malloc and free patterns, and apply safe fixes to dynamic memory handling for robust code.
Identify fishy values using Valgrind to detect negative malloc sizes, understand size_t unsigned behavior, and fix argument order in padding calculations to allocate positive memory, with an accompanying exercise.
Investigate memory leaks in C using Valgrind, identify missing frees in allocations, and fix by freeing memory and adding a destroy function for strings.
Follow a structured workflow to fix memory bugs in C: read the code and readme.md, then compile, run, and review warnings with valgrind across multiple source files.
After you've learned the basics of the C programming language, including becoming familiar with pointers, you're ready to start working on some real projects. Whether you're writing your own code from scratch, or maintaining and extending code written by somebody else, you'll quickly find that a major source of software defects in C programs is improper memory management.
Memory-related bugs can be difficult and extremely time-consuming to diagnose and fix without good tools. This course will introduce you to some tools and techniques for finding and fixing memory bugs in C programs, as well as teach the concepts behind those issues. It will cover:
Getting set up
Installing Windows Subsystem for Linux (WSL) and Ubuntu (if you're a Windows user)
Installing gcc, make, and Valgrind
Integrating VS Code into a WSL workflow
Lessons on how to find and fix these kinds of memory bugs:
Uninitialized values
Invalid reads
Invalid writes
Invalid frees
Fishy values
Memory leaks
In each lesson, we will examine a sample C program and use the powerful open-source Valgrind tool to find its defects. For each kind of bug, there will also be a hands-on exercise for you to work through. At the very end there is a final coding challenge that will help you to review everything you’ve learned in the course.
You'll need a solid start on the C language before you attempt this course, so if you're new to C, I would highly recommend first working through one of the C for Beginners Udemy courses.