
Course introduction.
Installation process of Xcode & command line tools. Using Xcode for creating C/C++ applications.
Using Xcode for debugging C/C++ applications. Usage of windows such as stack, expressions, breakpoints, etc.
Discussion on memory management and issues.
Introduction to built-in malloc debugging library
Source code.
Usage of malloc debugging to detect heap overflows & double-free/delete.
Introduction to the Guard Malloc provided through libgmalloc library.
Using libgmalloc to detect buffer overflows and use after free errors.
Source code
Explanation of how libgmalloc works internally.
How libgmalloc detects buffer underflows. Explanation of the header that is used to store magic number and other information.
Enabling libgmalloc through command line.
Introduction to leaks command line tool.
Source code
Using MallocStackLogging with leaks tool for generating stack traces during leaks.
Using leaks tool to detect leaks in running processes.
Source code
Explanation of the concept of root leak
Explanation of the concept of root cycle. Understanding leaks caused due to cyclic dependencies.
Source code
Customizing leaks command through command line options.
Generating memory graph in Xcode for detecting leaks.
Understanding root cycles & chained pointers in memory graph.
Generating memory graph with leaks command. Using generated memory graphs to suppress already detected leaks.
Introduction to Xcode debug navigation window and the information it presents during debugging.
Source code
Using debug navigator to detect usage of various resources by the application.
Using debug navigator to understand allocation & deallocation patterns in the application.
Introduction to Xcode instruments.
Using Allocations template to view allocations in a running process.
Source code
Detecting leaks through Allocations template.
Explanation of memory snapshots.
Using the "Mark Generation" feature to take memory snapshots in the Allocations instrument.
Using memory snapshots to detect leaks.
Introduction to the leaks template of Instruments.
Using Leaks instrument to detect leaks.
Mixing leaked & non-leaked allocations.
C++ is a large and complex language, but it gives programmers complete freedom when it comes to management of dynamic memory. This allows the programmers to allocate memory and manipulate it at runtime. That is why C++ is still a favorite language for high performance applications in various domains such as gaming, telecom, finance, aerospace, etc.
However, it requires programmers to take great care while using dynamic memory, such as releasing acquired memory, taking care not to overstep memory boundary, etc. Otherwise, it could lead to problems such as dangling pointers, memory corruption, memory leaks, etc.
This course will help you overcome all these problem by leveraging the tools provided on macOS platform. It has a rich set of functions provided by the C/C++ runtime heap library. These functions can help detect memory leaks, overflows, etc. You'll learn how to use these functions effectively and make your programs bug-free.
In this course, you'll start with the basics of heap memory management and understand C & C++ allocation functions/operators in depth. You'll also learn how to effectively use them to avoid memory problems. Afterwards, you'll learn about the Xcode Malloc Debugging library functions and understand how to use them in your code. You'll also use the guarded memory allocator to effectively detect heap corruptions. You'll also gain knowledge of Xcode instruments, leaks command & more that can help you detect leaks.
By the end of this course, you'll have a deep understanding of dynamic memory management. You'll be able to use standard tools effectively to detect & isolate memory problems.
Note: This course is ONLY for macOS platform