$ account kstenerud
KSCrash is a production-grade crash reporting and system monitoring library for Apple platforms (iOS, macOS, tvOS, watchOS, visionOS). It captures Mach exceptions, Unix signals, C++ and Objective-C exceptions, main thread hangs, watchdog timeouts, and OS-level terminations (OOM, thermal, CPU, reboot). The library generates Apple-format crash reports with full backtraces, binary images, system state, and user-provided context. It also includes performance monitors for CPU usage, memory pressure, and boot time, as well as a sampling profiler. The architecture is modular: a low-level C core provides async-signal-safe stack unwinding (compact unwind, DWARF CFI, frame pointer), safe memory access, JSON encoding/decoding, and a key-value store. Higher-level Objective-C and Swift modules implement individual crash monitors (Mach, signal, NSException, C++ exception, zombie, watchdog, termination, lifecycle, resource, user info) that register via a plugin API. Reports are stored on disk with mmap'd sidecar files for cross-launch state, then processed through a filter pipeline (demangling, compression, JSON formatting, diagnostic analysis) and delivered via configurable sinks (HTTP, email, console). The library is distributed as Swift packages and CocoaPods pods, with extensive CI covering unit tests, integration tests, benchmarks, static analysis, and API stability checks. Key strengths include rigorous async-signal-safety in crash-time code, a lock-free binary image cache for fast symbolication, a streaming JSON codec with pluggable callbacks, and a sidecar system that persists monitor data across app launches. The codebase demonstrates high craftsmanship in low-level systems programming, concurrency, and Apple platform internals. While primarily a crash reporter, its monitoring and profiling capabilities make it a comprehensive observability tool for Apple applications.