Exercise 2: Slow Screen, Growing Memory — Possible Solution ============================================================ TASK Say which instruments you would use for each symptom and what you would look at. ANSWER Both start with Product -> Profile so you measure a Release build. SLOW WHEN OPENED - Time Profiler. - Record while opening the screen, then read the call tree. Follow the heaviest stack trace, and compare the weight (share of samples) with the self column (time in that method itself). MEMORY HIGHER AFTER TEN OPEN/CLOSE CYCLES - Allocations first: watch Persistent Bytes, the memory still held. If it rises each cycle and does not fall, something is not being released. - Then Leaks: look for allocations without retainers and check the Cycles & Roots view for a retain cycle. WHY BOTH INSTRUMENTS FOR MEMORY Leaks may miss a cycle that a live object still references, so Persistent Bytes in Allocations is a useful second check.