What is thread sanitizer and how does it detect race conditions?

Updated May 17, 2026

Short answer

Thread Sanitizer detects concurrent memory access violations at runtime.

Deep explanation

TSan instruments memory access and tracks thread ownership. If two threads access the same memory without synchronization and at least one writes, it flags a race condition. It introduces overhead but is extremely effective for debugging concurrency bugs.

Unlock with a Pro subscription to view this section.

View pricing

Real-world example

No real-world example available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Common mistakes

No common mistakes listed yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Follow-up questions

No follow-up questions available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

More Objective-C interview questions

View all →