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 stars144 forks26 contributorsActive · 9h agoSince 2022MIT

Meet the team

See all 26 on GitHub →
JacksonGL
JacksonGL522 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 →
TypeScript62.8%
JavaScript36.4%
CSS0.4%
MDX0.3%
HTML0.1%
Shell0.1%

Commit activity

Last 12 weeks · 96 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 9h 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 · 1mo 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 · 4mo ago

Recent fixes

View closed PRs →
Abhirup0
[core] Boundary edge cases and in-place array mutation in `getNumberAtPercentile`ClosedIssue

While looking through trace sampling and percentile calculations in , I noticed a few boundary edge cases in (): 1. 100th percentile returns : When , evaluates to . Since , it tries to return , which evaluates to (for example, accessing index on a length-5 array instead of the maximum element at index ). 2. Empty array returns (causing in callers): For an empty array , and it returns (). When this flows into via , produces , which causes subsequent `` Happy to submit a quick PR with unit tests if this looks good to you!

Abhirup0 · 1d ago
Abhirup0
[api] `takeSnapshots` does not pass `config` to `TestPlanner`ClosedIssue

While exploring the programmatic API in , I noticed a small configuration mismatch in (). In (line 156) and (line 191), is initialized with the run's config instance: However, in (line 226), is constructed without arguments: Because is omitted, defaults its internal to the global singleton . When options like a transient working directory, custom , , or custom scenario settings are passed to , the scenario synthesizers instantiated inside receive instead of the newly created instance for this run. Proposed fix: Pass to in , matching and : I'd be happy to open a PR for this if this looks good to the maintainers!

Abhirup0 · 1d ago
rootkiller6788
fix(core): don't double-count representative trace in ML clusteringMergedPR

Problem When is enabled, double-counts the representative trace of every cluster: The HAC union-find labels in point every trace at the largest index in its cluster, and exactly one trace per cluster satisfies (the representative). For that one trace, , so it is inserted by the seed and pushed again by the loop — every cluster ends up containing its representative twice. This propagates to , so and are inflated by 1 per cluster, and even a single leaked object reports . Fix Initialize each cluster list empty and let the loop add every trace exactly once. Test Added , which fails before the fix (single trace → 2) and passes after (each trace counted once). All core and heap-analysis tests pass.

rootkiller6788 · 3d ago
Structured data for AI agents

Repository: facebook/memlab. Description: A framework for finding JavaScript memory leaks and analyzing heap snapshots Stars: 5029, Forks: 144. Primary language: TypeScript. Languages: TypeScript (62.8%), JavaScript (36.4%), CSS (0.4%), MDX (0.3%), 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: 9h 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