JavaScript & Advanced ES6+ (0-to-Hero Big Tech Standard)
›
08. Garbage Collection Mechanics & Memory Leak Profiling
50 mins
Course Syllabus
Interactive Lesson Studio
Loading lesson content...
🎯 Big Tech Coding & Interview Challenges
Practice these curated problems. Click "Load in Sandbox" to solve live in the Code Studio!
Easy
1. Self-Cleaning Auto-Timer Registry
Implement a `TimerRegistry` class that tracks created `setInterval` / `setTimeout` timers and provides a single `.clearAll()` method to eliminate timer memory leaks.
💡 View Pro Interview Hint
• Store timer IDs in a Set.
Medium
2. Garbage-Collectable Cache with WeakMap
Build a metadata cache `MetadataCache` using `WeakMap` so that cached user objects are automatically garbage-collected when the user object is deleted elsewhere in the app.
💡 View Pro Interview Hint
• WeakMap holds weak references allowing keys to be GC-ed.
JavaScript