
#Russian collection of information facebook how to
Instead, MemLab can be easily integrated in a CI/CD pipeline, say Gong and Conner.įor in-browser memory leak detection, the only input MemLab requires from developers is a test scenario file that defines how to interact with the webpage by overriding three callbacks with the Puppeteer API and CSS selectors. While Chrome Developer Tools provides the essential means to inspect memory behaviour of JavaScript code, including the timeline view and the profiles view, this is not straightforward and cannot be automated. Other cases where you can have leaks or unbound memory growth are related to the accidental use of global variables, to forgotten timers or callbacks, and to out-of-DOM references, says auth0 engineer Sebastian Peyrott. For example, say Facebook engineers Liang Gong and Glenn Conner, when you log an object to Chrome console, Chrome will take a hidden reference to it that will prevent it from being collected. There are a number of cases where JavaScript may leak memory. Additionally, to reduce the amount of information that needs to be analyzed, MemLab is able to cluster leaked objects based on the similarity of their retainer traces and show them for each cluster instead of for each potential leak. By inspecting the retainer traces, you can visualize which references should have been set to null for proper collection. an object reference chain from the garbage collector roots. In a nutshell, MemLab finds memory leaks by running a headless browser through predefined test scenarios and diffing and analyzing the JavaScript heap snapshots.īased on the diff results, MemLab builds a list of potential memory leaks and for each of them generates a retainer traces, i.e.

To detect all possible cases where memory is leaked, Facebook created and open-sourced MemLab, a tool able to run predefined, automatable test scenarios and analyze heapshot diffs. While JavaScript runtimes use garbage collection to manage memory, this does not rule out the possibility of leaking memory.
