Node.js · Senior · Question 3 of 75
Which pattern is a classic cause of a memory leak in a Node.js server?
- 1A local variable inside a request handler
- ✓Correct answer: A module-level
Mapused as a cache that is filled on every request and never evicted - 3Using
constinstead oflet
Explanation
Anything reachable from a module-level object lives forever. Use a bounded LRU cache with TTL, a WeakMap keyed by objects, or an external cache like Redis.