Repository navigation
Tags
Tags
fix: point docs and repo links at the meta GitHub org Summary: The `facebook` GitHub org was renamed to `meta` (https://fb.workplace.com/groups/metaopensource/permalink/29110262721924097/), and a new, empty `facebook` org took the old name. GitHub Pages does not redirect after an org rename, so https://facebook.github.io/memlab/ now 404s ("There isn't a GitHub Pages site here"). The site is served at https://meta.github.io/memlab/. This moves every memlab link to the new org: - `website/docusaurus.config.js`: `url` is now `https://meta.github.io/` and `organizationName` is `meta`, so canonical URLs, the sitemap and edit links match where the site is served. `baseUrl` stays `/memlab/`. - `facebook.github.io/memlab` and `github.com/facebook/memlab` (including `git@github.com:facebook/memlab.git`) become `meta.github.io/memlab` and `github.com/meta/memlab` in the READMEs, `AI.md`, the docs, the search index config, the homepage, and the `homepage`/`repository`/`bugs` fields of every package `package.json`. Links to other projects (for example `github.com/facebook/react`) are unchanged. The npm package pages keep the old links until the next release. ___ landed-with-radar-review Differential Revision: D128198143 fbshipit-source-id: a5d111054843a48095eb5de2b7a3af92f8d4b7c5
feat(mcp-server): `memlab_anonymize_snapshot`, and stop warning about… … anonymized captures that are fine Summary: Two changes, both about captures that have had user data removed. **A tool to do it.** `memlab_anonymize_snapshot` wraps the `memlab/core` API: point it at a capture, get one that can be attached to a task or handed to a model. It accepts the same local paths, `manifold://` URLs and bare snapshot filenames every other snapshot tool does, and takes `mode`, `salt`, `extra_patterns` and `keep_patterns`. `audit_only` inspects a capture without writing anything, which is how you check one that someone else anonymized. The reason this is a tool rather than a note in a wiki is that doing it by hand goes wrong in a way that looks fine. On the capture that motivated it, every string VALUE had been replaced — and 26,303 account handles and 1,325 serialized DOM fragments were still in the clear, because those are property names and node names rather than string values. Nothing about the file looked suspicious. So the output always ends with **what was not removed**, grouped by character-class shape with examples, printed even when that list is empty. A tool that reports only what it took invites the reader to conclude the rest was safe. `output_path` is required and must differ from the input: defaulting it would write an anonymized copy somewhere the caller did not name, and matching it would destroy the only unredacted copy. **A banner that was firing on the wrong thing.** `detectAnonymizedStrings` recognized exactly one shape of anonymization — every character replaced by one filler — and warned that all duplication and interning figures below it were fiction. That warning is correct for that shape and was worth having; it caught `memlab_quick_diagnosis` reporting 47.4 MB of interning savings that did not exist. But the new default preserves distinctness, so on those captures the duplication figures are exactly as true as on the original, and the old detector would have either stayed silent (missing that the capture is anonymized at all) or, had it been widened naively, told readers to discard correct findings. The detector now distinguishes three states — `none`, `uniform`, `stable` — and only `uniform` keeps the "these numbers are manufactured" banner. `stable` gets an informational one instead: the numbers are trustworthy, but a sample value tells you nothing about the real data, so identify records by property shape rather than by value. `AnonymizationCheck.anonymized` keeps its old meaning so existing call sites are unaffected. MCP server `version` 2.85.1 -> 2.86.0 across every mirrored location, plugin `version` 1.106.1 -> 1.107.0. Minor: one tool added, no existing tool, parameter or field changed. ___ Differential Revision: D117917439 fbshipit-source-id: 46870dc431974830ecfd0300cd5e133c06021876
fix(core): use Lengauer-Tarjan to fix dominator hang Summary: The dominator-tree and retained-size computation in `TraceFinder` used the iterative Cooper-Harvey-Kennedy fix-point. On some real browser heap snapshots it could spin forever at the "calculating dominators and retained sizes" step (one CPU pinned at 100% with a flat heap, never completing): the post-order assigned to orphan / weakly-reachable nodes (nodes unreachable from the GC root) can violate the invariant the fix-point's two-finger `intersect()` walk relies on, so a finger either steps onto the out-of-bounds "empty" sentinel (`dominators[emptySlot]` reads past the end of the array) or walks a cycle in the provisional dominator pointers, and the loop never terminates. Even when it did terminate it needed O(graph-depth) sweeps. A contributing bug: the forward post-order pass (`buildPostOrderIndex`) and the backward retainer pass (`calculateDominatorNodesFromPostOrder`) used different edge-essentiality predicates — the backward pass applied an extra `shouldTraverseEdge()` leak-trace filter the forward pass did not — so their reachability disagreed and corrupted the dominator relation. This replaces the fix-point with the Lengauer-Tarjan algorithm (Lengauer & Tarjan, 1979), the same near-linear, single-pass algorithm Chrome DevTools now uses. It gives every node a valid DFS number (handling orphans and mutually-retaining "clique" nodes by attaching them to the root), computes immediate dominators in one pass with no fix-point to oscillate, and uses a single shared essential-edge predicate for both the forward DFS and the backward retainer scan so the two passes always agree. Result: a 371 MB / 3,419,351-node / 19,954,862-edge browser snapshot that previously hung indefinitely now loads in ~14s with correct retained sizes. Reviewed By: boujeepossum Differential Revision: D111340869 fbshipit-source-id: bb136334faff61a5a43e36c5c56377c7f5fa331f
fix(core): support analyzing heap snapshot with more than 2^24 nodes Summary: JS heap snapshots can contain more than 16,777,216 (2^24) nodes, which exceeds the V8 `Set` maximum capacity. This causes a `RangeError: Set maximum size exceeded` when MemLab tries to collect all node IDs into a single `Set<number>`. This diff introduces a `NumericSet` class that shards elements across multiple native `Set<number>` instances using value-range-based partitioning (5M elements per shard). It provides the same API as `Set<number>` (`add`, `has`, `delete`, `forEach`, `size`, `Symbol.iterator`) so it works as a drop-in replacement. The `HeapNodeIdSet` type alias is updated from `Set<number>` to `NumericSet`, and all call sites that collect node IDs are updated to use `NumericSet`. For small collections, `NumericSet` just wraps a single native Set with minimal overhead. #142 Differential Revision: D102351647 fbshipit-source-id: 4517f6e0987071767a75f72de93b9530d4323f28
fix(memlab): reexport @memlab/core types in memlab package Summary: OSS request: #34 This diff also adds a postinstall script to fix the website build issue: The problem: webpackbar@5.0.2 extends webpack's ProgressPlugin and overwrites this.options with its own properties (name, color, reporters, reporter). webpack@5.106+ added strict schema validation that checks this.options against the ProgressPlugin schema, which rejects those unknown properties. Why postinstall: webpackbar is a transitive dependency of docusaurus/core@2.0.0-beta.21 — we don't control its version directly. The postinstall script patches webpackbar's source after npm install/yarn install to rename this.options to this.barOptions, so the webpackbar-specific config no longer collides with the ProgressPlugin's validated this.options. We may need to upgrade Docusaurus to v3 (which drops webpackbar or uses a compatible version), but this would be a larger change later. Differential Revision: D101117105 fbshipit-source-id: 62f07d7127f6fe7fb5ed88693de757f0e94f5f6d
feat(heap-analysis): support analyzing js source code strings in the … …heap string analysis Summary: This diff adds logic in `memlab analyze string` command so that it can extract and analyze JS code strings in the heap snapshots. Reviewed By: twobassdrum Differential Revision: D89912914 fbshipit-source-id: 57a89778690e5b943aa931574723226ac0115502
fix(core): set the max depth for object structural traversal when ser… …ializing leak traces Summary: To limit the maximum size of the serialized JSON representation of the memory leak trace, this diff introduces two configuration options that constrain both the breadth and depth during serialization: * When serializing each node (object) in the leak trace, only up to the configured number of outgoing references (edges) are included. * The recursive serialization via `JSONifyNode` is capped at the configured maximum depth into the object graph. Differential Revision: D74195874 fbshipit-source-id: cbc632643cef0729a77009deff779680dbad1f96
PreviousNext