#918·matrix

Increase `DYLD_IMAGE_MACOUNT`

Author: xkwooCreated Sep 9, 2026Updated Sep 9, 2026

Problem

In iOS 18+, the number of loaded dynamic library images has increased significantly, exceeding the default limit of 768 (DYLD_IMAGE_MACOUNT). This causes incomplete crash stack symbolication, showing "unknown" for some frames.

Environment

  • iOS version: iOS 18+
  • Matrix version: 2.1.1
  • Device: All iOS devices

Impact

When crash stack symbolication is performed, some binary images are truncated due to the limit, resulting in "unknown" frames in the crash report. This makes it difficult to diagnose and fix crashes.

Proposed Solution

Increase DYLD_IMAGE_MACOUNT from 768 to 2048 to accommodate the increased number of dynamic libraries in iOS 18+. Alternative solutions:

  1. Make it configurable via a compile-time flag
  2. Dynamically determine the limit based on the actual number of loaded images
  3. Provide an API to customize the limit

Related Code

File: Matrix/WCCrashBlockMonitor/KSCrash/Recording/Monitors/KSCrash_BinaryImageHandler.mm Macro: #define DYLD_IMAGE_MACOUNT 512 + 256

Statistics

iOS Version Average Image Count Current Limit (768) Proposed Limit (2048)
iOS 14 ~500 ✅ Sufficient ✅ Sufficient
iOS 15 ~600 ✅ Sufficient ✅ Sufficient
iOS 16 ~700 ⚠️ Near limit ✅ Sufficient
iOS 17 ~800 ❌ Exceeded ✅ Sufficient
iOS 18 ~900 ❌ Exceeded ✅ Sufficient

Workaround

Currently, we are patching the macro definition in our Podfile's post_install hook, but a native solution would be better.