Performance & Debugging
Instruments, memory leaks, retain cycles, launch time, and finding regressions before users do.
- How do you detect memory leaks in production? Production leak detection works from symptoms like memory telemetry and MetricKit's jetsam data, narrowing the search before Instruments confirms it.
- Which Instruments do you use most, and why? Time Profiler for CPU, Allocations for memory growth, and Leaks for cycles. Which one you reach for depends on the symptom you are chasing.
- How do you debug retain cycles at scale? Cycles at scale often span modules nobody wrote end to end, so telemetry narrows the search and the Memory Graph Debugger traces the actual chain.
- How do you profile CPU vs memory? Time Profiler's sampled call stacks show where CPU time goes, while Allocations tracks what stays alive, and the two meet around allocation churn.
- How do you design image caching? A two-tier design pairs NSCache for fast memory access with a size-capped disk cache, downsampling images via ImageIO and decoding off the main thread.
- How do you detect performance regressions? Detecting a regression needs a baseline first, so XCTest performance tests in CI, MetricKit data, and version-sliced telemetry all watch for a step change.
- How do you optimize app launch time? Launch time splits into pre-main, main to first frame, and first frame to interactive, each needing its own fix, from fewer frameworks to deferred setup.