@memlab/heap-analysis 1.0.39 → 1.0.40
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/dist/BaseAnalysis.js +6 -6
- package/dist/PluginUtils.js +2 -2
- package/dist/index.js +2 -2
- package/dist/plugins/ObjectShapeAnalysis.js +2 -2
- package/dist/plugins/ObjectUnboundGrowthAnalysis.js +4 -4
- package/dist/plugins/ReactComponentHookAnalysis.js +2 -2
- package/dist/plugins/StringAnalysis.js +1 -1
- package/package.json +3 -3
package/dist/BaseAnalysis.js
CHANGED
|
@@ -59,8 +59,8 @@ class Analysis {
|
|
|
59
59
|
* different return value format.
|
|
60
60
|
* @internal
|
|
61
61
|
*/
|
|
62
|
-
run() {
|
|
63
|
-
return __awaiter(this,
|
|
62
|
+
run(options = PluginUtils_1.default.defaultAnalysisArgs) {
|
|
63
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
64
64
|
loadScenarioConfig();
|
|
65
65
|
yield this.process(options);
|
|
66
66
|
});
|
|
@@ -94,8 +94,8 @@ class Analysis {
|
|
|
94
94
|
* });
|
|
95
95
|
* ```
|
|
96
96
|
*/
|
|
97
|
-
analyzeSnapshotFromFile(
|
|
98
|
-
return __awaiter(this,
|
|
97
|
+
analyzeSnapshotFromFile(file, options = {}) {
|
|
98
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
99
99
|
if (options.workDir) {
|
|
100
100
|
// set and init the new work dir
|
|
101
101
|
core_1.config.defaultFileManagerOption = options;
|
|
@@ -144,8 +144,8 @@ class Analysis {
|
|
|
144
144
|
* });
|
|
145
145
|
* ```
|
|
146
146
|
*/
|
|
147
|
-
analyzeSnapshotsInDirectory(
|
|
148
|
-
return __awaiter(this,
|
|
147
|
+
analyzeSnapshotsInDirectory(directory, options = {}) {
|
|
148
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
149
149
|
if (options.workDir) {
|
|
150
150
|
// set and init the new work dir
|
|
151
151
|
core_1.config.defaultFileManagerOption = options;
|
package/dist/PluginUtils.js
CHANGED
|
@@ -486,8 +486,8 @@ function getHeapFromFile(file) {
|
|
|
486
486
|
return yield loadProcessedSnapshot({ file });
|
|
487
487
|
});
|
|
488
488
|
}
|
|
489
|
-
function loadProcessedSnapshot() {
|
|
490
|
-
return __awaiter(this,
|
|
489
|
+
function loadProcessedSnapshot(options = {}) {
|
|
490
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
491
491
|
const opt = { buildNodeIdIndex: true, verbose: true };
|
|
492
492
|
const file = options.file || core_2.utils.getSnapshotFilePathWithTabType(/.*/);
|
|
493
493
|
const snapshot = yield core_2.utils.getSnapshotFromFile(file, opt);
|
package/dist/index.js
CHANGED
|
@@ -21,8 +21,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
21
21
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
22
22
|
};
|
|
23
23
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
exports.heapConfig = exports.heapAnalysisLoader = exports.PluginUtils = exports.StringAnalysis = exports.ObjectUnboundGrowthAnalysis = exports.ObjectShapeAnalysis = exports.ObjectFanoutAnalysis = exports.ShapeUnboundGrowthAnalysis = exports.ObjectSizeAnalysis = exports.ObjectShallowAnalysis = exports.CollectionsHoldingStaleAnalysis = exports.GlobalVariableAnalysis = exports.DetachedDOMElementAnalysis = exports.BaseAnalysis = exports.takeNodeFullHeap = exports.snapshotMapReduce = exports.loadHeapSnapshot = exports.getSnapshotFileForAnalysis = exports.getSnapshotDirForAnalysis = exports.getFullHeapFromFile = exports.getHeapFromFile = exports.getDominatorNodes = void 0;
|
|
25
|
-
exports.registerPackage = registerPackage;
|
|
24
|
+
exports.heapConfig = exports.heapAnalysisLoader = exports.PluginUtils = exports.StringAnalysis = exports.ObjectUnboundGrowthAnalysis = exports.ObjectShapeAnalysis = exports.ObjectFanoutAnalysis = exports.ShapeUnboundGrowthAnalysis = exports.ObjectSizeAnalysis = exports.ObjectShallowAnalysis = exports.CollectionsHoldingStaleAnalysis = exports.GlobalVariableAnalysis = exports.DetachedDOMElementAnalysis = exports.BaseAnalysis = exports.takeNodeFullHeap = exports.snapshotMapReduce = exports.loadHeapSnapshot = exports.getSnapshotFileForAnalysis = exports.getSnapshotDirForAnalysis = exports.getFullHeapFromFile = exports.getHeapFromFile = exports.getDominatorNodes = exports.registerPackage = void 0;
|
|
26
25
|
const path_1 = __importDefault(require("path"));
|
|
27
26
|
const core_1 = require("@memlab/core");
|
|
28
27
|
/** @internal */
|
|
@@ -31,6 +30,7 @@ function registerPackage() {
|
|
|
31
30
|
return core_1.PackageInfoLoader.registerPackage(path_1.default.join(__dirname, '..'));
|
|
32
31
|
});
|
|
33
32
|
}
|
|
33
|
+
exports.registerPackage = registerPackage;
|
|
34
34
|
const PluginUtils_1 = __importDefault(require("./PluginUtils"));
|
|
35
35
|
exports.getDominatorNodes = PluginUtils_1.default.getDominatorNodes,
|
|
36
36
|
/** @deprecated */
|
|
@@ -54,8 +54,8 @@ class ObjectShapeAnalysis extends BaseAnalysis_1.default {
|
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
56
|
/** @internal */
|
|
57
|
-
breakDownMemoryByShapes() {
|
|
58
|
-
return __awaiter(this,
|
|
57
|
+
breakDownMemoryByShapes(options = {}) {
|
|
58
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
59
59
|
const opt = { buildNodeIdIndex: true, verbose: true };
|
|
60
60
|
const file = options.file ||
|
|
61
61
|
core_1.utils.getSnapshotFilePathWithTabType(/.*/) ||
|
|
@@ -56,16 +56,16 @@ class ObjectUnboundGrowthAnalysis extends BaseAnalysis_1.default {
|
|
|
56
56
|
yield this.checkUnbound(opt);
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
|
-
checkUnbound() {
|
|
60
|
-
return __awaiter(this,
|
|
59
|
+
checkUnbound(options = {}) {
|
|
60
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
61
61
|
core_1.memoryBarChart.plotMemoryBarChart(options);
|
|
62
62
|
core_1.utils.checkSnapshots(options);
|
|
63
63
|
yield this.detectUnboundGrowth(options);
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
66
|
// find any objects that keeps growing
|
|
67
|
-
detectUnboundGrowth() {
|
|
68
|
-
return __awaiter(this,
|
|
67
|
+
detectUnboundGrowth(options = {}) {
|
|
68
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
69
69
|
const nodeInfo = Object.create(null);
|
|
70
70
|
let hasCheckedFirstSnapshot = false;
|
|
71
71
|
let snapshot = null;
|
|
@@ -76,8 +76,8 @@ class ReactComponentHookAnalysis extends BaseAnalysis_1.default {
|
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
78
|
/** @internal */
|
|
79
|
-
breakDownMemoryByReactComponents() {
|
|
80
|
-
return __awaiter(this,
|
|
79
|
+
breakDownMemoryByReactComponents(options = {}) {
|
|
80
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
81
81
|
const opt = { buildNodeIdIndex: true, verbose: true };
|
|
82
82
|
const file = options.file ||
|
|
83
83
|
core_1.utils.getSnapshotFilePathWithTabType(/.*/) ||
|
|
@@ -208,6 +208,7 @@ class StringAnalysis extends BaseAnalysis_1.default {
|
|
|
208
208
|
}
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
|
+
exports.default = StringAnalysis;
|
|
211
212
|
/**
|
|
212
213
|
* collect statistics for specified string patterns
|
|
213
214
|
* pattern name -> string pattern checker
|
|
@@ -243,4 +244,3 @@ StringAnalysis.stringPatternsToObserve = {
|
|
|
243
244
|
return true;
|
|
244
245
|
},
|
|
245
246
|
};
|
|
246
|
-
exports.default = StringAnalysis;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memlab/heap-analysis",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.40",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "heap analysis plugins for memlab",
|
|
6
6
|
"author": "Liang Gong <lgong@meta.com>",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"LICENSE"
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@memlab/core": "^1.1.
|
|
24
|
-
"@memlab/e2e": "^1.0.
|
|
23
|
+
"@memlab/core": "^1.1.43",
|
|
24
|
+
"@memlab/e2e": "^1.0.43",
|
|
25
25
|
"ansi": "^0.3.1",
|
|
26
26
|
"babar": "^0.2.0",
|
|
27
27
|
"chalk": "^4.0.0",
|