CS Fundamentals Trainer · JavaScript · Performance & Memory

In a single-page app, which of these commonly cause memory to grow each time a view is opened and closed?

  1. A `resize` listener added to `window` when the view mounts and never removed
  2. A large array created in a function that has returned and isn't referenced anywhere
  3. A `setInterval` started by the view and never cleared
  4. A module-level `Map` that caches API responses by URL with no eviction
  5. Removed DOM nodes still referenced from a JavaScript array

Difficulty: easy

Answer this question

Related questions