memlab 1.1.34 → 1.1.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +27 -16
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,25 +1,25 @@
1
1
  # memlab
2
2
 
3
- memlab is an E2E testing and analysis framework for finding JavaScript memory
4
- leaks and optimization opportunities.
3
+ memlab is an end-to-end testing and analysis framework for identifying
4
+ JavaScript memory leaks and optimization opportunities.
5
5
 
6
6
  Online Resources:
7
- * [Meta Engineering Blog Post](https://engineering.fb.com/2022/09/12/open-source/memlab/)
8
7
  * [Official Website and Demo](https://facebook.github.io/memlab)
9
8
  * [Documentation](https://facebook.github.io/memlab/docs/intro)
9
+ * [Meta Engineering Blog Post](https://engineering.fb.com/2022/09/12/open-source/memlab/)
10
10
 
11
11
  Features:
12
- * **Browser memory leak detection** - Write test scenario with puppeteer API,
13
- memlab auto diffs JS heap snapshots, filters out memory leaks, and
14
- aggregates results.
15
- * **Object-oriented heap traversing API** - Supports self-defined memory leak
16
- detector and programmatically analyzing JS heap snapshots taken from
17
- Chromium-based browsers, Node.js, Electron.js, and Hermes
12
+ * **Browser memory leak detection** - Write test scenarios with the Puppeteer
13
+ API, and memlab will automatically compare JavaScript heap snapshots, filter
14
+ out memory leaks, and aggregate the results
15
+ * **Object-oriented heap traversing API** - Supports the creation of
16
+ self-defined memory leak detector, and enables programmatic analysis JS heap
17
+ snapshots taken from Chromium-based browsers, Node.js, Electron.js, and Hermes
18
18
  * **Memory CLI toolbox** - Built-in toolbox and APIs for finding memory
19
- optimization opportunities (not necessarily memory leaks)
20
- * **Memory assertions in Node.js** - Enables unit test or running node.js
21
- program to take a heap snapshot of its own state, do self memory checking,
22
- or write advanced memory assertions
19
+ optimization opportunities (not necessarily just memory leaks)
20
+ * **Memory assertions in Node.js** - Enables unit tests or running node.js
21
+ programs to take a heap snapshot of their own state, perform self memory
22
+ checking, or write advanced memory assertions
23
23
 
24
24
  ## CLI Usage
25
25
 
@@ -96,13 +96,24 @@ with readable variables, function name, and property names on objects).
96
96
  Alternatively, you can debug the leak by loading the heap snapshot taken by memlab (saved in `$(memlab get-default-work-dir)/data/cur`)
97
97
  in Chrome DevTool and search for the leaked object ID (`@182929`).
98
98
 
99
- **Self-defined leak detector**: If you want to use a self-defined leak detector, add a `filterLeak` callback
100
- ([doc](https://facebook.github.io/memlab/docs/api/interfaces/core_src.IScenario/#-optional-beforeleakfilter-initleakfiltercallback))
99
+ **View Retainer Trace Interactively**
100
+
101
+ View memory issues detected by memlab based on a single JavaScript
102
+ heap snapshot taken from Chromium, Hermes, memlab, or any node.js
103
+ or Electron.js program:
104
+ ```bash
105
+ memlab view-heap --snapshot <PATH TO .heapsnapshot FILE>
106
+ ```
107
+
108
+ You can optionally specify a specific heap object with the object's id: `--node-id @28173` to pinpoint a specific object.
109
+
110
+ **Self-defined leak detector**: If you want to use a self-defined leak detector, add a `leakFilter` callback
111
+ ([doc](https://facebook.github.io/memlab/docs/api/interfaces/core_src.IScenario/#-optional-leakfilter-leakfiltercallback))
101
112
  in the scenario file. `filterLeak` will be called for every unreleased heap
102
113
  object (`node`) allocated by the target interaction.
103
114
 
104
115
  ```javascript
105
- function filterLeak(node, heap) {
116
+ function leakFilter(node, heap) {
106
117
  // ... your leak detector logic
107
118
  // return true to mark the node as a memory leak
108
119
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "memlab",
3
- "version": "1.1.34",
3
+ "version": "1.1.36",
4
4
  "license": "MIT",
5
5
  "description": "memlab is a framework that analyzes memory and finds memory leaks in JavaScript applications.",
6
6
  "main": "dist/index.js",