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.
- package/README.md +27 -16
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
# memlab
|
|
2
2
|
|
|
3
|
-
memlab is an
|
|
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
|
|
13
|
-
memlab
|
|
14
|
-
|
|
15
|
-
* **Object-oriented heap traversing API** - Supports
|
|
16
|
-
detector and
|
|
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
|
|
21
|
-
|
|
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
|
-
**
|
|
100
|
-
|
|
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
|
|
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
|
};
|