All challenges
Multiple ChoiceHard 45s

Observer and memory leaks

Event listeners registered on a long-lived publisher are never unregistered, and short-lived subscribers accumulate. What is the classic problem and fix?
Options
  1. 1Observer is inherently unsafe; replace it with polling
  2. 2The publisher must clone every listener on notify to avoid leaks
  3. 3Listeners should be static to avoid garbage collection
  4. 4Lapsed-listener leak; use weak references or explicit unsubscribe on lifecycle end

Think you can answer under pressure?

Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.

Play this in a 3-minute battle