memlab 1.1.29 → 1.1.32
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 +8 -8
- package/bin/memlab +2 -2
- package/bin/preinstall +1 -1
- package/dist/index.js +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -5,8 +5,8 @@ leaks and optimization opportunities.
|
|
|
5
5
|
|
|
6
6
|
Online Resources:
|
|
7
7
|
* [Meta Engineering Blog Post](https://engineering.fb.com/2022/09/12/open-source/memlab/)
|
|
8
|
-
* [Official Website and Demo](https://
|
|
9
|
-
* [Documentation](https://
|
|
8
|
+
* [Official Website and Demo](https://facebook.github.io/memlab)
|
|
9
|
+
* [Documentation](https://facebook.github.io/memlab/docs/intro)
|
|
10
10
|
|
|
11
11
|
Features:
|
|
12
12
|
* **Browser memory leak detection** - Write test scenario with puppeteer API,
|
|
@@ -32,7 +32,7 @@ npm install -g memlab
|
|
|
32
32
|
### Find Memory Leaks
|
|
33
33
|
|
|
34
34
|
To find memory leaks in Google Maps, you can create a
|
|
35
|
-
[scenario file](https://
|
|
35
|
+
[scenario file](https://facebook.github.io/memlab/docs/api/interfaces/core_src.IScenario) defining how
|
|
36
36
|
to interact with the Google Maps, let's name it `test-google-maps.js`:
|
|
37
37
|
|
|
38
38
|
```javascript
|
|
@@ -67,7 +67,7 @@ memlab will print memory leak results showing one representative
|
|
|
67
67
|
retainer trace for each cluster of leaked objects.
|
|
68
68
|
|
|
69
69
|
**Retainer traces**: This is the result from
|
|
70
|
-
[an example website](https://
|
|
70
|
+
[an example website](https://facebook.github.io/memlab/docs/guides/guides-find-leaks),
|
|
71
71
|
the retainer trace is an object reference chain from the GC root to a leaked
|
|
72
72
|
object. The trace shows why and how a leaked object is still kept alive in
|
|
73
73
|
memory. Breaking the reference chain means the leaked object will no longer
|
|
@@ -97,7 +97,7 @@ Alternatively, you can debug the leak by loading the heap snapshot taken by meml
|
|
|
97
97
|
in Chrome DevTool and search for the leaked object ID (`@182929`).
|
|
98
98
|
|
|
99
99
|
**Self-defined leak detector**: If you want to use a self-defined leak detector, add a `filterLeak` callback
|
|
100
|
-
([doc](https://
|
|
100
|
+
([doc](https://facebook.github.io/memlab/docs/api/interfaces/core_src.IScenario/#-optional-beforeleakfilter-initleakfiltercallback))
|
|
101
101
|
in the scenario file. `filterLeak` will be called for every unreleased heap
|
|
102
102
|
object (`node`) allocated by the target interaction.
|
|
103
103
|
|
|
@@ -110,7 +110,7 @@ function filterLeak(node, heap) {
|
|
|
110
110
|
|
|
111
111
|
`heap` is the graph representation of the final JavaScript heap snapshot.
|
|
112
112
|
For more details, view the
|
|
113
|
-
[doc site](https://
|
|
113
|
+
[doc site](https://facebook.github.io/memlab/docs/api/interfaces/core_src.IHeapSnapshot).
|
|
114
114
|
|
|
115
115
|
### Heap Analysis and Investigation
|
|
116
116
|
|
|
@@ -126,7 +126,7 @@ memlab analyze unbound-object --snapshot-dir <DIR_OF_SNAPSHOT_FILES>
|
|
|
126
126
|
```
|
|
127
127
|
|
|
128
128
|
Use `memlab analyze` to view all built-in memory analyses.
|
|
129
|
-
For extension, view the [doc site](https://
|
|
129
|
+
For extension, view the [doc site](https://facebook.github.io/memlab).
|
|
130
130
|
|
|
131
131
|
View retainer trace of a particular object:
|
|
132
132
|
```bash
|
|
@@ -192,4 +192,4 @@ test('memory test with heap assertion', async () => {
|
|
|
192
192
|
```
|
|
193
193
|
|
|
194
194
|
For other APIs check out the
|
|
195
|
-
[API documentation](https://
|
|
195
|
+
[API documentation](https://facebook.github.io/memlab/docs/api/interfaces/core_src.IHeapSnapshot#hasobjectwithclassnameclassname).
|
package/bin/memlab
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#!/usr/bin/env node --expose-gc --max-old-space-size=4096
|
|
1
|
+
#!/usr/bin/env -S node --expose-gc --max-old-space-size=4096
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
8
8
|
*
|
|
9
9
|
* @format
|
|
10
|
-
* @oncall
|
|
10
|
+
* @oncall web_perf_infra
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
var path = require('path');
|
package/bin/preinstall
CHANGED
package/dist/index.js
CHANGED
|
@@ -34,7 +34,7 @@ exports.registerPackage = void 0;
|
|
|
34
34
|
* LICENSE file in the root directory of this source tree.
|
|
35
35
|
*
|
|
36
36
|
* @format
|
|
37
|
-
* @oncall
|
|
37
|
+
* @oncall web_perf_infra
|
|
38
38
|
*/
|
|
39
39
|
const path_1 = __importDefault(require("path"));
|
|
40
40
|
const core_1 = require("@memlab/core");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "memlab",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.32",
|
|
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",
|
|
@@ -70,10 +70,10 @@
|
|
|
70
70
|
],
|
|
71
71
|
"repository": {
|
|
72
72
|
"type": "git",
|
|
73
|
-
"url": "git+https://github.com/
|
|
73
|
+
"url": "git+https://github.com/facebook/memlab.git"
|
|
74
74
|
},
|
|
75
75
|
"bugs": {
|
|
76
|
-
"url": "https://github.com/
|
|
76
|
+
"url": "https://github.com/facebook/memlab/issues"
|
|
77
77
|
},
|
|
78
|
-
"homepage": "https://github.com/
|
|
78
|
+
"homepage": "https://github.com/facebook/memlab#readme"
|
|
79
79
|
}
|