runtime diagnostics

The following runtime diagnostics and logging options can be enabled in the scheme editor.

Runtime Sanitization options:

Option

Description

Address Sanitizer

Finds memory corruptions and other memory errors at runtime. Memory errors can lead to unpredictable behavior and can be hard to reproduce consistently. For details, read Address Sanitizer.

Thread Sanitizer

Detects data races at runtime. For example, when multiple threads access the same memory without synchronization and at least one access is a write. For details, read Thread Sanitizer.

Undefined Behavior Sanitizer

Detects undefined behavior at runtime. For example, any operation with unspecified semantics, such as dividing by zero, loading memory from a misaligned pointer, or dereferencing a null pointer. For details, read Undefined Behavior Sanitizer.

Note: Enabling Runtime Sanitization options requires recompilation the next time you Run your app for debugging.

Runtime API Checking:

Option

Description

Main Thread Checker

Detects invalid usage of AppKit, UIKit, and other APIs on a background thread. For details, read Main Thread Checker.

Memory Management options:

Option

Description

Malloc Scribble

Fills allocated memory with 0xAA and deallocated memory with 0x55.

Malloc Guard Edges

Adds guard pages before and after large allocations.

Guard Malloc

Uses libgmalloc to catch common memory problems such as buffer overruns and use-after-free.

Zombie Objects

Replaces deallocated objects with zombie objects. When you send a message to a zombie object, the runtime logs an error and crashes. You can look at the backtrace to see the chain of calls that triggered the zombie detector.

Logging options:

Option

Description

Malloc Stack

Records stack logs for memory allocations and deallocations.

Dynamic Linker API Usage

Logs dynamic-linker API calls (for example, dlopen).

Dynamic Library Loads

Logs dynamic-linker library loads.