Skip to content

Laboratory · JavaScript Lab

Closure memory investigation

Briefing

Why does removing a listener sometimes free nothing, and why can a tiny function retain an enormous object?

A one-line callback keeps a 40MB array alive for the lifetime of the page. Find out which line did it.

Laboratory
JavaScript Lab
Level
RESEARCHER
Estimated time
10 minutes
Method
investigation
Variables under observation
closuresenvironment recordreachabilitygarbage collectionleaks