Detecting Memory Leaks in C/C++ Applications

Detecting Memory Leaks in C/C++ Applications
Detecting Memory Leaks in C/C++ Applications
English | MP4 | AVC 1920×1080 | AAC 44KHz 2ch | 6h 16m | 1.73 GB

Apply techniques to detect and isolate memory-related errors in Visual Studio

C++ is a comprehensive and complex language, however, it also gives programmers complete freedom when it comes to the management of dynamic memory. This allows them to allocate memory and manipulate it at runtime, one of the reasons why C++ is still a favorite language for high-performance applications in various domains such as gaming, telecom, finance, and aerospace. However, using C++ also requires programmers to take great care while using dynamic memory, such as releasing acquired memory and avoiding the risk of overstepping the memory boundary, as not being cautious could lead to problems such as dangling pointers, memory corruption, and memory leaks.

This course is designed to help you overcome such problems by using essential Visual Studio features effectively. You’ll go on to explore the rich set of functions provided by the C/C++ runtime heap library. These functions can help you detect memory leaks and even overflows efficiently. Progressing through the sections, you’ll understand how to use these functions and make your programs bug-free. In addition to this, you’ll also learn how to effectively use them to avoid memory problems.

By the end of this course, you’ll have the skills you need to use CRT heap functions confidently to detect and isolate memory problems.


  • Understand the different kinds of problems associated with memory management
  • Detect and isolate memory problems effectively
  • Become confident in C/C++ memory management
Table of Contents

1 Process Memory Layout
2 Pointers
3 Using Visual Studio
4 Debugging in Visual Studio
5 Byte Ordering
6 C Allocation Functions Overview
7 C Allocation Functions – malloc, calloc
8 C Allocation Functions – realloc

Dynamic Memory Allocation in C++
9 C++ Allocation Operators
10 How new works – Part I
11 How new works – Part II
12 Handling new Failure – Exception
13 Handling new Failure – Handler
14 Handling new Failure – nothrow
15 Non-throwing new Example – Part I
16 Non-throwing new Example – Part II
17 Placement new – I
18 Placement new – II
19 Placement new – III
20 Placement new – IV
21 Placement new – V
22 Operator new & delete Functions

Memory Management Issues
23 Memory Management Issues
24 Uninitialized Pointers – I
25 Uninitialized Pointers – II
26 Buffer Overflow – Stack
27 Buffer Overflow – Heap
28 Dangling Pointers – I
29 Dangling Pointers – II
30 Memory Leaks – I
31 Memory Leaks – II

Detecting Heap Corruption
32 String class – I
33 String class – II
34 String class – III
35 String class – IV
36 String class – V
37 Detecting Heap Corruption in String Class
38 Heap Checker Class – I
39 Heap Checker Class – II
40 Heap Checker Class – III
41 Heap Checker Class – IV
42 Heap Checker Class – V

Detecting Memory leaks
43 CrtDumpMemory() function
44 CrtDumpMemoryLeaks() Code Example
45 Leak Detection Flags
46 Detailed Leak Dump For new
47 Memory Snapshots
48 Memory Snapshots – Code Example
49 Memory Checkpoint Helper Class
50 Issues with Checkpoints (& Resolution)
51 Snapshots in Visual Studio – I
52 Snapshots in Visual Studio – II
53 Report Mode & Type
54 Report Mode & Type – Code Example
55 Report Mode File

Custom Leak Detector
56 Leak Detection Internals
57 Memory Block Header & ptmalloc() Function
58 Implementation Of ptfree() Function
59 Implementation Of PtDumpLeaks() Function
60 Adding C++ Support – I
61 Adding C++ Support – Part II
62 Compiling on Linux

Heap Corruption Support
63 Detecting Heap Corruption – Internal Implementation
64 PtCheckMemory() Implementation – I
65 PtCheckMemory() Implementation – II
66 Alignment & Structure Padding
67 Aligning Memory Block Header