<h1 align="center" <a href="https://facebook.github.io/memlab/"MemLab</a </h1
<p align="center" <a href="https://github.com/facebook/memlab/blob/master/LICENSE" <img alt="Licensed under the MIT License" src="https://img.shields.io/badge/License-MIT-blue.svg"/ </a <a href="https://github.com/facebook/memlab/blob/main/CONTRIBUTING.md" <img alt="PR's Welcome" src="https://img.shields.io/badge/PRs%20-welcome-brightgreen.svg"/ </a <a href="https://www.npmjs.com/package/memlab?activeTab=readme" <img alt="npm version" src="https://img.shields.io/npm/v/memlab.svg?style=flat"/ </a </p
memlab is an end-to-end testing and analysis framework for identifying JavaScript memory leaks and optimization opportunities.
Online Resources: [Website and Demo] | [Documentation] | [Meta Engineering Blog Post] | [AI Assistant Guide]
Features:
- Browser memory leak detection - Write test scenarios with the Puppeteer
API, and memlab will automatically compare JavaScript heap snapshots, filter out memory leaks, and aggregate the results
- Object-oriented heap traversal API - Supports the creation of
custom memory leak detectors, and enables programmatic analysis of JS heap snapshots taken from Chromium-based browsers, Node.js, Electron.js, and Hermes
- Memory CLI toolbox - Built-in toolbox and APIs for finding memory
optimization opportunities (not necessarily just memory leaks)
- MemLens: Browser Memory Debugging Tools - Enables visualization of memory
leaks and interactive memory debugging in the browser.
- Memory assertions in Node.js - Enables unit tests or running node.js
programs to take a heap snapshot of their own state, perform self memory checking, or write advanced memory assertions
- MCP server for AI coding assistants - Provides an MCP server that gives
AI coding assistants (Claude Code, Cursor, etc.) interactive tools to load heap snapshots, find memory leaks, and investigate optimization opportunities through natural language conversation