iOS Platform & SwiftUI (50 Qs)•Part 2: Combine, Persistence, Security & Networking (11 - 24)
What is Memory Profiling with Xcode Instruments (Allocations vs Leaks)?
junior LevelPerformanceSecurity & Auth
In Simple Words:
- Allocations Instrument: Tracks heap memory growth and object lifecycles over time. Helps identify Abandoned Memory (objects that are technically referenced and not leaked, but kept in memory unnecessarily, e.g. unconstrained image caches).
- Leaks Instrument: Periodically scans process memory for unreferenced memory blocks and cycles that can never be freed.
- Generation Analysis: Marks a baseline before entering a screen and evaluates delta after exiting; any retained memory indicates a leak.