As the Facebook engineering team notes: “People using our web apps will often notice performance and functional correctness issues immediately. A memory leak, however, … isn’t immediately perceivable.” Instead, users will get a gradually less responsive session. The consequences of memory leaks are more severe in single-page applications (SPAs), because the user may continue to interact with the page for an extended period, and MemLab is specifically designed for this scenario.
React represents the browser DOM (Document Object Model) in-memory using objects called Fibers which are stored in a tree structure. This can be a cause of “huge memory leaks,” according to the team, because “the downside of having a strongly connected graph is that if there is any outside reference pointing to any part of the graph, the whole graph cannot be garbage collected.”
Browsers including Chrome, Edge and Firefox do have their own memory inspection tools, but as a dev commented on Hacker News, “it’s incredibly difficult to debug memory leak even with dev tools.”
Another strong feature of MemLab is the ability to run it in tests as part of a command-line process, meaning that if a severe leak is introduced it can be caught before an application makes it into production.