EXC_BAD_ACCESS iOS Origin: On your device OSI layer 7 · Application Last updated 13 Oct 2026

Thread 1: EXC_BAD_ACCESS (code=1, address=0x0)

The app accessed memory it shouldn’t — a dangling pointer, released object, unsafe pointer misuse, a data race, or infinite recursion (stack overflow).

Exact message you may see Thread 1: EXC_BAD_ACCESS (code=1, address=0x0)EXC_BAD_ACCESS (code=2
Seen on: iOS

Meaning

In Swift it often comes from unowned references to deallocated objects, Unsafe pointers, Objective-C interop, or concurrent mutation. code=2 with a deep stack usually means infinite recursion. Zombies and Address/Thread Sanitizer pinpoint it.

Common causes

  • Accessing a deallocated object (unowned/unsafe reference, delegate not weak/strong properly)
  • Infinite recursion overflowing the stack
  • Data race on shared state
  • Misused UnsafePointer / C interop

⚡ Quick fix

  1. Enable Zombie Objects and Address Sanitizer in the scheme
  2. Look at the stack for recursion
  3. Enable Thread Sanitizer for races

Detailed fix by platform

Xcode

  1. # Product → Scheme → Edit Scheme → Run → Diagnostics → Address Sanitizer, Thread Sanitizer, Zombie Objects

How to diagnose

  1. Stack — Repeating frames (recursion)?
  2. Object — Which object was released?
  3. Threads — Concurrent access?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: On your device. Errors that are often confused with or caused by this one (click to open):

0xC0000005 — The application was unable to start correctly (0xc0000005) / Exception code 0xc0000005 access violation (Windows)0xC0000005attempted to access privacy-sensitive data without a usage description — This app has crashed because it attempted to access privacy-sensitive data without a usage description (iOS)attempted to access p…Cannot allocate memory — fork: Cannot allocate memory / ENOMEM (Linux)Cannot allocate memoryCould not cast value of type — Swift: Could not cast value of type 'X' to 'Y' (iOS)Could not cast value …double free or corruption — C/C++: free(): double free detected / double free or corruption (out) — Aborted (core dumped) (C/C++)double free or corrup…dyld: Library not loaded — dyld: Library not loaded: @rpath/X.framework/X — Reason: image not found (crash on launch) (iOS)dyld: Library not loa…heap out of memory — FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory (Node.js)heap out of memoryIndex out of range — Swift: Fatal error: Index out of range (iOS)Index out of rangeEXC_BAD_A…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.