Behind the Scenes
Execution internals: call stack, heap, garbage collection, optimization strategies and memory leaks.
What this section covers
This category reveals the runtime internals that determine performance and memory behavior: how the call stack and heap are used, garbage collection basics, and low-level optimizations engines perform.
Why this matters to a developer
Knowing how memory and execution are managed helps you avoid leaks, write more performant code, and interpret profiler output more effectively.
How to use this section
Read Call Stack and Heap & Garbage Collection to get the core ideas. Then dive into microtasks and optimization strategies for deeper performance tuning.
π Related:
FAQ
Q: Do I need to master engine optimizations?
A: No, but understanding them helps shape patterns that perform well in the real world.
Topics in this section
Call Stack
Explain the call stack, how function calls are tracked, and stack traces.
Heap & Garbage Collection
Overview of memory allocation in JavaScript, heap vs stack, and how garbage collection works at a high level.
Microtask Queue
Explain microtasks vs macrotasks and why microtasks have higher priority.
Event Delegation
How event delegation works in the DOM and why it's efficient for dynamic content.
Execution Phase
Explain creation and execution phases of the execution context and variable instantiation.
Memory Leaks
Common causes of memory leaks in JS apps and detection/mitigation strategies.
Hidden Classes & Optimizations
How engines optimize property access using hidden classes and inline caches.