Debugging & Profiling Memory in Xcode

Master the art of diagnosing and fixing memory issues, crashes, hangs, and performance problems in C/C++ applications on macOS. This course teaches you to effectively use Xcode's powerful debugging and profiling tools, including libgmalloc, the leaks command, Memory Graphs, AddressSanitizer, crash reports, and Instruments (Allocations, Leaks, and Time Profiler), to ensure your applications are stable, responsive, and high-performing.

Image14

Course Description

This comprehensive course empowers C/C++ developers to effectively diagnose and resolve complex runtime issues—including memory errors, crashes, hangs, and performance bottlenecks—within the macOS environment. You'll gain practical expertise in leveraging Xcode's robust suite of debugging and profiling tools, including libgmalloc for detecting memory corruption, the leaks command-line utility for quick analysis, and visual tools like Memory Graphs. You will also work with AddressSanitizer to uncover subtle memory bugs, and use Instruments such as Allocations, Leaks, and Time Profiler to analyze memory usage and CPU behavior in depth.


Crucially, the course covers crash and hang analysis, where you'll learn to interpret crash reports, understand Mach exceptions, perform symbolication, and diagnose unresponsive applications using tools like sample and spindump. By the end, you will be equipped to systematically identify root causes and build stable, efficient, and high-performance C/C++ applications for Apple platforms.

Curriculum

Understand in detail on what is planned under each module

Instructions

🧑‍🏫 Course Introduction

📊 Course Material

📄 Source Code

Process Memory Layout

Xcode Installation & Basic Usage

Memory Management Issues

Introduction To Debugging

Defensive Coding - I

Defensive Coding - II

Assertions

Assertions Guidelines

Compile-Time Assertions

Debugging in Xcode

Assignment 1

Assignment 2

Practice

Quiz

Malloc Debugging - I

Malloc Debugging - II

Libgmalloc (Guard Malloc) Introduction

Detecting Buffer Overflows - I

Detecting Buffer Overflows - II

Detecting Buffer Overflows - III

Detecting Buffer Underflows

Command Line Usage

Progress Update

Quiz

leaks Command Line Tool

Using leaks Command - I

Using leaks Command - II

Root Leak

Root Cycle

leaks Command Line Options

Memory Graph Root Leaks

Memory Graph Root Cycles & Chained Pointers

Memory Graph With leaks Command

Quiz

Debug Navigator Introduction

Debug Navigator Usage

Memory Window In Debug Navigator

Introduction To Instruments

Allocations Instrument - I

Allocations Instrument - II

Allocations Instrument - III

Allocations Instrument - IV

Allocations Instrument - V

Leaks Instrument - I

Leaks Instrument - II

Leaks Instrument - III

Quiz

Slide Deck

Source Code

Introduction

Setup

Shadow Memory

Heap Buffer Overflow

Heap Use After Free

Allocation Routine Mismatch

Stack & Global Memory

Global Memory Issues

Stack Memory Issues

User Poisoned Memory

User Poisoned Memory Examples

Conditional Compilation

Disabling Instrumentation

Disabling Instrumentation Examples

More Options

ASan Options Examples

Quiz

Source Code

Introduction

Profiling Templates

Time Profiler Instrument

Time Profiler Example

Time Profiler Tracks

Detail Pane Options

Symbolication

Points of Interest

Multithreading

CPUs Tab

Single Thread Profiling

Multiple Threads With Coarse Grained Locking

Multiple Threads With Fine Grained Locking

Multiple Threads With No Locking

Summary

Source Code

Source Code

Introduction

File Activity Example

File Activity Tracks

Analyzing File Activity Trace

Suimmary

macOS Architecture

Crash!

Crash Report Introduction

Interpreting Crash Report - I

Interpreting Crash Report - II

Interpreting Crash Report - III

Mach Exceptions

EXC_BAD_ACCESS - I

EXC_BAD_ACCESS - II

EXC_CRASH

EXC_BAD_INSTRUCTION

EXC_BREAKPOINT

Debug Symbols

Examining Symbols

Crash Report Symbolication

Xcode Symbolication

Introduction to Hangs

Hang Example

Hang Vs Progress

sample Command

sample Example - I

sample Example - II

sample Example - III

sample Example - IV

Hang Summary

UI Application Hang

Mutex Wait

Mutex Deadlock

spindump Command

spindump Example

Mutex Deadlock (spindump)

Xcode Timeprofiler

Final Assignment

🏅 Course Certificate

Why Do This Course

Learn proven techniques to diagnose and fix memory issues, crashes, and hangs that impact stability and performance in your C/C++ applications.

Become proficient with Xcode’s debugging and profiling tools to analyze runtime behavior with precision.

Detect complex memory errors such as buffer overflows, use-after-free, and leaks using tools like AddressSanitizer and libgmalloc.

Analyze crash reports, understand Mach exceptions, and perform symbolication to identify root causes of application failures.

Diagnose UI hangs and threading issues using tools like sample, spindump, and Time Profiler.

Gain practical experience with Instruments (Allocations, Leaks, Time Profiler) to deeply analyze memory usage and CPU performance.

Requirements

  • Basic knowledge of C++
  • Xcode 16.0 on macOS

Reviews

See what other students have to say about the course

Good Course, nice explanation of concepts along with practical application.

Pushp

The course is really well structured and helps a lot

Anusha

learnt a lot of things, especially address sanitizer can be very helpful for memeory issues.

Himanshu

Very Nice Content

Vinay

Related Products

Additional courses that may be relevant to your interests

Image23

Instructor


- Hello! I'm Umar Lone

I've educated and mentored students and professionals globally, leveraging over 20 years of experience in C++, Object-Oriented Programming, Design Patterns, and related technologies. My professional background includes significant contributions to C++, Java, and C# projects with esteemed companies, alongside providing specialized project consultation & mentoring.


My current focus is on delivering comprehensive video courses that distill this extensive knowledge. I specialize in transforming intricate concepts into clear, practical, and actionable insights, supported by real-world examples. This approach is designed to equip you with the necessary clarity and confidence for sustained growth and impactful contributions within your projects and career trajectory.


Begin your learning journey with me now and unlock the advanced understanding and practical expertise essential for making a significant impact in your field.


Keep in touch

Subscribe for announcements, new courses & discount coupons

Yes please, save my details so you can send me educational content that is relevant and helpful.