memlab
by
facebook

Description: A framework for finding JavaScript memory leaks and analyzing heap snapshots

View on GitHub ↗

Summary Information

Updated 37 minutes ago
Added to GitGenius on November 13th, 2022
Created on May 26th, 2022
Open Issues & Pull Requests: 13 (+0)
Number of forks: 142
Total Stargazers: 5,000 (+0)
Total Subscribers: 42 (+0)

Issue Activity (beta)

Open issues: 2
New in 7 days: 0
Closed in 7 days: 0
Avg open age: 730 days
Stale 30+ days: 1
Stale 90+ days: 1

Recent activity

Opened in 7 days: 0
Closed in 7 days: 0
Comments in 7 days: 0
Events in 7 days: 0

Top labels

No label distribution available yet.

Most active issues this week

No issue events were indexed in the last 7 days.

Repository Insights (GitGenius)

Median issue/PR response: 7.1 hours
Mean response time: 24.5 days
90th percentile: 131.0 days
Tracked items: 23

Most active contributors

Detailed Description

MemLab is an end-to-end testing and analysis framework developed by Facebook for identifying JavaScript memory leaks and discovering memory optimization opportunities. Written primarily in TypeScript, it provides developers with tools to automatically detect memory leaks in web applications by comparing JavaScript heap snapshots and filtering results across multiple runtime environments including Chromium-based browsers, Node.js, Electron.js, and Hermes.

The framework's core functionality centers on browser memory leak detection through scenario-based testing. Developers write test scenarios using the Puppeteer API, and MemLab automatically captures and analyzes heap snapshots to identify leaked objects. The tool generates retainer traces that show the reference chain from the garbage collection root to leaked objects, helping developers understand exactly why objects remain in memory and which references need to be cleared. This approach transforms memory leak detection from a manual debugging process into an automated workflow integrated into testing pipelines.

MemLab includes an object-oriented heap traversal API that enables custom memory leak detector creation and programmatic analysis of heap snapshots. This extensibility allows teams to build detectors tailored to their specific applications and memory patterns. The framework also provides a memory CLI toolbox with built-in commands for analyzing heap snapshots, viewing object growth during interactions, and investigating memory optimization opportunities beyond just leak detection.

A notable feature is MemLens, a browser-based memory debugging tool that enables interactive visualization of memory leaks directly in the browser interface. Additionally, MemLab supports memory assertions in Node.js environments, allowing unit tests and running programs to take heap snapshots of their own state and perform self-memory checking with advanced assertions.

Recent development has introduced an MCP server for AI coding assistants, packaged as @memlab/mcp-server. This integration provides Claude Code, Cursor, Windsurf, and other AI assistants with interactive tools to load heap snapshots, find memory leaks, and identify optimization opportunities through natural language conversation. The MCP server exposes tools for loading snapshots, viewing summaries, finding largest objects by retained size, detecting detached DOM nodes, inspecting closures, and analyzing duplicated strings.

According to GitGenius activity tracking, the repository shows a median issue and pull request response latency of 7.1 hours across 23 tracked items, indicating active maintenance. JacksonGL emerges as the most active contributor with 67 tracked events, followed by doteric with 9 events and gyzerok with 5 events. The repository maintains connections with other major projects including sveltejs/svelte, microsoft/vscode, and puppeteer/puppeteer through overlapping contributors, suggesting integration points and shared development practices across these ecosystems.

The project is MIT licensed and actively welcomes contributions through its documented contributing guide. MemLab's comprehensive approach to memory leak detection, combined with its support for multiple JavaScript runtimes and integration with modern AI development tools, positions it as a significant resource for JavaScript developers focused on performance optimization and memory management.

memlab
by
facebookfacebook/memlab

Repository Details

Fetching additional details & charts...