GitShow/facebook/memlab
facebook

memlab

A framework for finding JavaScript memory leaks and analyzing heap snapshots

by facebook
detectore2efacebookheaphermesjavascriptleakmemory
Star on GitHubForkWebsitenpm

TypeScript

5.0k stars142 forks23 contributorsActive · 19h agoSince 2022MIT

Meet the team

See all 23 on GitHub →
JacksonGL
JacksonGL449 contributions
tulga1970
tulga197011 contributions
Drizzlecrj
Drizzlecrj9 contributions
mrsharpoblunto
mrsharpoblunto5 contributions
LuciNyan
LuciNyan3 contributions
aelij
aelij2 contributions
kleookku
kleookku2 contributions
arunsathiya
arunsathiya1 contribution

Languages

View on GitHub →
TypeScript54%
JavaScript45.3%
MDX0.4%
CSS0.2%
HTML0.1%

Commit activity

Last 12 weeks · 54 commits

Full graph →

Community health

4 of 6 standards met

Community profile →
75
✓README✓License✓Contributing✓Code of Conduct○Issue Template○PR Template

Recent PRs & issues

Active · 2 in progress · Last activity 19h ago
See all on GitHub →
foreseaz
Discussion: How memlab supports NodeJS memory leak detectionOpenIssue

Hi memlab devs, thanks for the great tool. I'm excited to try to integrate it into my current NodeJS app tests. I'm wondering what's current status or future road map is on supporting NodeJS memory leak detection. Currently, most test cases and demos are running in browsers detecting front-end side memory leaks. Would you plan to give more support on NodeJS?

foreseaz · 37m ago
miinhho
feat: add playwright integration feature OpenPR

Summary New package — a Playwright fixture that attaches memlab's leak detection to existing Playwright tests by destructuring a parameter. No scenario rewrite, no Puppeteer dependency. Motivation memlab's existing APIs (, ) drive the browser through a Puppeteer-based scenario runner. Teams already running Playwright e2e suites can't attach leak detection without rewriting their specs. This package bridges the gap by piggybacking on the user's existing page via a CDP session. Design notes Chromium only. Heap snapshots go over CDP, which Playwright only exposes for Chromium. On Firefox / WebKit the fixture becomes a no-op: the test still runs, no leak detection, a memlab-skip annotation is attached. README calls this out. Opt-in per test. Fixture setup runs only when memlab is destructured. Tests that don't use it pay no overhead 3-phase snapshot (baseline / target / final) wired to fixture lifecycle. via , no flag required. Configurable. for per-project GC tuning and custom filters. Merge semantics preserve prior fields. CI-friendly failure output. picks the hop (not the Window root), strips memlab-internal metadata from attached JSON, and heap snapshots only attach when leaks are detected (skips ~13 MB per clean test). API : Capture baseline heap snapshot / : Manual phase control : Per-test tuning : Returns : Hard assertion with triage-friendly error If neither nor is called, the fixture auto-captures missing phases and soft-asserts no leaks during teardown.

miinhho · 2mo ago
machineghost
Playwright SupportOpenIssue

I was so excited when I read about this project ... until I realized it was for Pupeteer :( Any chance you'd consider adding Playwright support for this library?

machineghost · 5mo ago

Recent fixes

View closed PRs →
MdAyanHassan
Does memlab also mark the detached fiber nodes when we run the find-leaks command?ClosedIssue

I was looking around memory leak detection and stuff and came across memlab. I looked in the docs and have a basic idea of how memlab works, but I had a question. When memlab receives the three snapshots namely baseline, target and final, it generates a superset of leaked object by the formula (T-B) ∩ F. Now when we run the find-leaks command and pass in these 3 snapshots, does memlab internally also mark each fiber node as detached by following its retainer path and finding whether it is connected to a root fiber node or not. In the chrome devtools I do not see the word Detached beside the FiberNode objects, how does memlab decide which fiber nodes are detached and which are not?

MdAyanHassan · 3w ago
adamraine
RangeError: Set maximum size exceededClosedIssue

Node count in one of the heap snapshots is 16,997,604 which exceeds the maximum size of 16,777,216. For context, this started happening after upgrading Chrome to M148 which seems to include a lot more nodes in heap snapshots. Assuming this is an intentional change with Chrome, I'm wondering if it's possible to use a different data structure that can accommodate larger node counts.

adamraine · 2mo ago
miinhho
Fix typo in E2E testing framework documentationMergedPR

Fixed a typo in the documentation, changing "teesting" to "testing" in the E2E frameworks integration guide.

miinhho · 2mo ago
Structured data for AI agents

Repository: facebook/memlab. Description: A framework for finding JavaScript memory leaks and analyzing heap snapshots Stars: 4989, Forks: 142. Primary language: TypeScript. Languages: TypeScript (54%), JavaScript (45.3%), MDX (0.4%), CSS (0.2%), HTML (0.1%). License: MIT. Homepage: https://facebook.github.io/memlab/ Topics: detector, e2e, facebook, heap, hermes, javascript, leak, memory, nodejs, perf-tools, performance, snapshot, v8. Open PRs: 2, open issues: 11. Last activity: 19h ago. Community health: 75%. Top contributors: JacksonGL, tulga1970, Drizzlecrj, mrsharpoblunto, LuciNyan, aelij, kleookku, arunsathiya, eltociear, mehmetmalli and others.

·@ofershap

Replace github.com with gitshow.dev