@memlab/core 1.1.20 → 1.1.22
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/index.d.ts +2 -0
- package/dist/index.js +4 -1
- package/dist/lib/Config.d.ts +11 -0
- package/dist/lib/Config.js +26 -1
- package/dist/lib/Constant.js +1 -0
- package/dist/lib/FileManager.d.ts +3 -0
- package/dist/lib/FileManager.js +10 -1
- package/dist/lib/HeapAnalyzer.d.ts +5 -1
- package/dist/lib/HeapAnalyzer.js +56 -34
- package/dist/lib/RunInfoUtils.d.ts +39 -0
- package/dist/lib/RunInfoUtils.js +86 -0
- package/dist/lib/TraceSampler.d.ts +36 -0
- package/dist/lib/TraceSampler.js +78 -0
- package/dist/lib/Types.d.ts +12 -2
- package/dist/lib/Utils.d.ts +31 -19
- package/dist/lib/Utils.js +124 -145
- package/dist/lib/charts/MemoryBarChart.d.ts +1 -0
- package/dist/lib/charts/MemoryBarChart.js +18 -3
- package/dist/lib/heap-data/HeapStringNode.js +25 -16
- package/dist/lib/leak-filters/rules/FilterOverSizedNodeAsLeak.rule.js +50 -0
- package/dist/lib/trace-filters/BaseTraceFilter.rule.d.ts +29 -0
- package/dist/lib/trace-filters/BaseTraceFilter.rule.js +22 -0
- package/dist/lib/trace-filters/LeakTraceFilter.d.ts +20 -0
- package/dist/lib/trace-filters/LeakTraceFilter.js +37 -0
- package/dist/lib/trace-filters/TraceFilterRuleList.d.ts +13 -0
- package/dist/lib/trace-filters/TraceFilterRuleList.js +35 -0
- package/dist/lib/trace-filters/rules/FilterAttachedDOMToDetachedDOMTrace.rule.d.ts +15 -0
- package/dist/lib/trace-filters/rules/FilterAttachedDOMToDetachedDOMTrace.rule.js +55 -0
- package/dist/lib/trace-filters/rules/FilterCppRootsToDetachedDOMTrace.rule.d.ts +15 -0
- package/dist/lib/trace-filters/rules/FilterCppRootsToDetachedDOMTrace.rule.js +44 -0
- package/dist/lib/trace-filters/rules/FilterDOMNodeChainTrace.rule.d.ts +15 -0
- package/dist/lib/trace-filters/rules/FilterDOMNodeChainTrace.rule.js +41 -0
- package/dist/lib/trace-filters/rules/FilterHermesTrace.rule.d.ts +15 -0
- package/dist/lib/trace-filters/rules/FilterHermesTrace.rule.js +29 -0
- package/dist/lib/trace-filters/rules/FilterInternalNodeTrace.rule.d.ts +15 -0
- package/dist/lib/trace-filters/rules/FilterInternalNodeTrace.rule.js +57 -0
- package/dist/lib/trace-filters/rules/FilterPendingActivitiesTrace.rule.d.ts +15 -0
- package/dist/lib/trace-filters/rules/FilterPendingActivitiesTrace.rule.js +62 -0
- package/dist/lib/trace-filters/rules/FilterShadowRootTrace.rule.d.ts +15 -0
- package/dist/lib/trace-filters/rules/FilterShadowRootTrace.rule.js +44 -0
- package/dist/lib/trace-filters/rules/FilterStyleEngineTrace.rule.d.ts +15 -0
- package/dist/lib/trace-filters/rules/FilterStyleEngineTrace.rule.js +49 -0
- package/dist/logger/LeakClusterLogger.js +1 -0
- package/dist/paths/TraceFinder.js +17 -3
- package/dist/trace-cluster/TraceBucket.d.ts +1 -1
- package/dist/trace-cluster/TraceBucket.js +20 -14
- package/dist/trace-cluster/strategies/TraceSimilarityStrategy.js +1 -0
- package/package.json +1 -1
|
@@ -30,7 +30,7 @@ class MemoryBarChart {
|
|
|
30
30
|
Console_1.default.warning(`plot data not load correctly: ${Utils_1.default.getError(ex).message}`);
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
|
-
if (plotData
|
|
33
|
+
if (!this.isPlotDataValid(plotData)) {
|
|
34
34
|
if (Config_1.default.verbose) {
|
|
35
35
|
Console_1.default.warning('no memory usage data to plot');
|
|
36
36
|
}
|
|
@@ -57,6 +57,21 @@ class MemoryBarChart {
|
|
|
57
57
|
}));
|
|
58
58
|
Console_1.default.topLevel('');
|
|
59
59
|
}
|
|
60
|
+
isPlotDataValid(plotData) {
|
|
61
|
+
if (plotData.length === 0) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
let isEntryValueAllZero = true;
|
|
65
|
+
for (const entry of plotData) {
|
|
66
|
+
if (entry.length !== 2) {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
if (entry[1] !== 0) {
|
|
70
|
+
isEntryValueAllZero = false;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return !isEntryValueAllZero;
|
|
74
|
+
}
|
|
60
75
|
loadPlotDataFromTabsOrder(tabsOrder) {
|
|
61
76
|
for (const tab of tabsOrder) {
|
|
62
77
|
if (!(tab.JSHeapUsedSize > 0)) {
|
|
@@ -82,12 +97,12 @@ class MemoryBarChart {
|
|
|
82
97
|
}
|
|
83
98
|
loadPlotData(options = {}) {
|
|
84
99
|
// plot data for a single run
|
|
85
|
-
if (!options.
|
|
100
|
+
if (!options.controlWorkDirs && !options.treatmentWorkDir) {
|
|
86
101
|
return this.loadPlotDataFromWorkDir(options);
|
|
87
102
|
}
|
|
88
103
|
// plot data for control and test run
|
|
89
104
|
const controlPlotData = this.loadPlotDataFromWorkDir({
|
|
90
|
-
workDir: options.
|
|
105
|
+
workDir: options.controlWorkDirs && options.controlWorkDirs[0],
|
|
91
106
|
});
|
|
92
107
|
const testPlotData = this.loadPlotDataFromWorkDir({
|
|
93
108
|
workDir: options.treatmentWorkDir,
|
|
@@ -21,25 +21,34 @@ class HeapStringNode extends HeapNode_1.default {
|
|
|
21
21
|
}
|
|
22
22
|
get stringValue() {
|
|
23
23
|
var _a, _b, _c;
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
const stack = [this];
|
|
25
|
+
let ret = '';
|
|
26
|
+
while (stack.length > 0) {
|
|
27
|
+
const node = stack.pop();
|
|
28
|
+
const type = node.type;
|
|
29
|
+
if (type === 'concatenated string') {
|
|
30
|
+
const firstNode = (_a = node.getReferenceNode('first')) === null || _a === void 0 ? void 0 : _a.toStringNode();
|
|
31
|
+
const secondNode = (_b = node.getReferenceNode('second')) === null || _b === void 0 ? void 0 : _b.toStringNode();
|
|
32
|
+
if (firstNode == null || secondNode == null) {
|
|
33
|
+
throw (0, HeapUtils_1.throwError)(new Error('broken concatenated string'));
|
|
34
|
+
}
|
|
35
|
+
stack.push(secondNode);
|
|
36
|
+
stack.push(firstNode);
|
|
37
|
+
continue;
|
|
30
38
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
39
|
+
if (type === 'sliced string') {
|
|
40
|
+
const parentNode = (_c = node.getReferenceNode('parent')) === null || _c === void 0 ? void 0 : _c.toStringNode();
|
|
41
|
+
if (parentNode == null) {
|
|
42
|
+
throw (0, HeapUtils_1.throwError)(new Error('broken sliced string'));
|
|
43
|
+
}
|
|
44
|
+
// sliced string in heap snapshot doesn't include
|
|
45
|
+
// the start index and the end index, so this may be inaccurate
|
|
46
|
+
ret += `<sliced string of @${parentNode.id}>`;
|
|
47
|
+
continue;
|
|
37
48
|
}
|
|
38
|
-
|
|
39
|
-
// the start index and the end index, so this may be inaccurate
|
|
40
|
-
return parentNode.stringValue;
|
|
49
|
+
ret += node.name;
|
|
41
50
|
}
|
|
42
|
-
return
|
|
51
|
+
return ret;
|
|
43
52
|
}
|
|
44
53
|
getJSONifyableObject() {
|
|
45
54
|
const rep = super.getJSONifyableObject();
|
|
@@ -8,8 +8,13 @@
|
|
|
8
8
|
* @format
|
|
9
9
|
* @oncall web_perf_infra
|
|
10
10
|
*/
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
11
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
15
|
exports.FilterOverSizedNodeAsLeakRule = void 0;
|
|
16
|
+
const Utils_1 = __importDefault(require("../../Utils"));
|
|
17
|
+
const Config_1 = require("../../Config");
|
|
13
18
|
const BaseLeakFilter_rule_1 = require("../BaseLeakFilter.rule");
|
|
14
19
|
/**
|
|
15
20
|
* trivial nodes are not reported as memory leaks
|
|
@@ -17,6 +22,10 @@ const BaseLeakFilter_rule_1 = require("../BaseLeakFilter.rule");
|
|
|
17
22
|
class FilterOverSizedNodeAsLeakRule {
|
|
18
23
|
filter(config, node) {
|
|
19
24
|
if (config.oversizeObjectAsLeak) {
|
|
25
|
+
// TODO: add support to skip this check
|
|
26
|
+
if (!isHeapNodeUsefulForLeakTraceDiffing(config, node)) {
|
|
27
|
+
return BaseLeakFilter_rule_1.LeakDecision.NOT_LEAK;
|
|
28
|
+
}
|
|
20
29
|
return node.retainedSize > config.oversizeThreshold
|
|
21
30
|
? BaseLeakFilter_rule_1.LeakDecision.LEAK
|
|
22
31
|
: BaseLeakFilter_rule_1.LeakDecision.NOT_LEAK;
|
|
@@ -25,3 +34,44 @@ class FilterOverSizedNodeAsLeakRule {
|
|
|
25
34
|
}
|
|
26
35
|
}
|
|
27
36
|
exports.FilterOverSizedNodeAsLeakRule = FilterOverSizedNodeAsLeakRule;
|
|
37
|
+
function isHeapNodeUsefulForLeakTraceDiffing(config, node) {
|
|
38
|
+
if (config.traceAllObjectsMode === Config_1.TraceObjectMode.Default) {
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
const name = node.name;
|
|
42
|
+
if (node.type !== 'object') {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
if (name.startsWith('system / ')) {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
if (Utils_1.default.isFiberNode(node) && !Utils_1.default.isDetachedFiberNode(node)) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
if (Utils_1.default.isDOMNodeIncomplete(node) && !Utils_1.default.isDetachedDOMNode(node)) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
if (node.getAnyReferrer('__proto__') != null) {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
if (node.getAnyReferrer('prototype') != null) {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
// react internal objects
|
|
61
|
+
if (node.getAnyReferrer('dependencies') != null) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
if (node.getAnyReferrer('memoizedState') != null) {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
if (node.getAnyReferrer('next') != null) {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
if (node.getAnyReferrer('deps') != null) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
if (node.getReference('baseQueue') != null) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
* @oncall web_perf_infra
|
|
9
|
+
*/
|
|
10
|
+
import type { MemLabConfig } from '../Config';
|
|
11
|
+
import type { HeapNodeIdSet, IHeapSnapshot, LeakTracePathItem } from '../Types';
|
|
12
|
+
/**
|
|
13
|
+
* Every leak trace filter rule needs to give a label
|
|
14
|
+
* to each leak trace passed to the filter
|
|
15
|
+
*/
|
|
16
|
+
export declare enum TraceDecision {
|
|
17
|
+
INSIGHTFUL = "insightful",
|
|
18
|
+
MAYBE_INSIGHTFUL = "maybe-insightful",
|
|
19
|
+
NOT_INSIGHTFUL = "not-insightful"
|
|
20
|
+
}
|
|
21
|
+
export declare type LeakTraceFilterOptions = {
|
|
22
|
+
config?: MemLabConfig;
|
|
23
|
+
snapshot?: IHeapSnapshot;
|
|
24
|
+
leakedNodeIds?: HeapNodeIdSet;
|
|
25
|
+
};
|
|
26
|
+
export interface ILeakTraceFilterRule {
|
|
27
|
+
filter(p: LeakTracePathItem, options: LeakTraceFilterOptions): TraceDecision;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=BaseTraceFilter.rule.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*
|
|
8
|
+
* @format
|
|
9
|
+
* @oncall web_perf_infra
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.TraceDecision = void 0;
|
|
13
|
+
/**
|
|
14
|
+
* Every leak trace filter rule needs to give a label
|
|
15
|
+
* to each leak trace passed to the filter
|
|
16
|
+
*/
|
|
17
|
+
var TraceDecision;
|
|
18
|
+
(function (TraceDecision) {
|
|
19
|
+
TraceDecision["INSIGHTFUL"] = "insightful";
|
|
20
|
+
TraceDecision["MAYBE_INSIGHTFUL"] = "maybe-insightful";
|
|
21
|
+
TraceDecision["NOT_INSIGHTFUL"] = "not-insightful";
|
|
22
|
+
})(TraceDecision = exports.TraceDecision || (exports.TraceDecision = {}));
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
* @oncall web_perf_infra
|
|
9
|
+
*/
|
|
10
|
+
import type { LeakTracePathItem } from '../Types';
|
|
11
|
+
import type { LeakTraceFilterOptions } from './BaseTraceFilter.rule';
|
|
12
|
+
/**
|
|
13
|
+
* apply the leak trace filter rules chain and decide
|
|
14
|
+
* if a leak trace is useful for memory debugging,
|
|
15
|
+
* by default all leak traces are considered useful
|
|
16
|
+
*/
|
|
17
|
+
export declare class LeakTraceFilter {
|
|
18
|
+
filter(p: LeakTracePathItem, options: LeakTraceFilterOptions): boolean;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=LeakTraceFilter.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*
|
|
8
|
+
* @format
|
|
9
|
+
* @oncall web_perf_infra
|
|
10
|
+
*/
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.LeakTraceFilter = void 0;
|
|
16
|
+
const BaseTraceFilter_rule_1 = require("./BaseTraceFilter.rule");
|
|
17
|
+
const TraceFilterRuleList_1 = __importDefault(require("./TraceFilterRuleList"));
|
|
18
|
+
/**
|
|
19
|
+
* apply the leak trace filter rules chain and decide
|
|
20
|
+
* if a leak trace is useful for memory debugging,
|
|
21
|
+
* by default all leak traces are considered useful
|
|
22
|
+
*/
|
|
23
|
+
class LeakTraceFilter {
|
|
24
|
+
filter(p, options) {
|
|
25
|
+
for (const rule of TraceFilterRuleList_1.default) {
|
|
26
|
+
const decision = rule.filter(p, options);
|
|
27
|
+
if (decision === BaseTraceFilter_rule_1.TraceDecision.INSIGHTFUL) {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
if (decision === BaseTraceFilter_rule_1.TraceDecision.NOT_INSIGHTFUL) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.LeakTraceFilter = LeakTraceFilter;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
* @oncall web_perf_infra
|
|
9
|
+
*/
|
|
10
|
+
import { ILeakTraceFilterRule } from './BaseTraceFilter.rule';
|
|
11
|
+
declare const _default: ILeakTraceFilterRule[];
|
|
12
|
+
export default _default;
|
|
13
|
+
//# sourceMappingURL=TraceFilterRuleList.d.ts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*
|
|
8
|
+
* @format
|
|
9
|
+
* @oncall web_perf_infra
|
|
10
|
+
*/
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const Constant_1 = __importDefault(require("../Constant"));
|
|
16
|
+
const InternalValueSetter_1 = require("../InternalValueSetter");
|
|
17
|
+
const FilterAttachedDOMToDetachedDOMTrace_rule_1 = require("./rules/FilterAttachedDOMToDetachedDOMTrace.rule");
|
|
18
|
+
const FilterCppRootsToDetachedDOMTrace_rule_1 = require("./rules/FilterCppRootsToDetachedDOMTrace.rule");
|
|
19
|
+
const FilterDOMNodeChainTrace_rule_1 = require("./rules/FilterDOMNodeChainTrace.rule");
|
|
20
|
+
const FilterHermesTrace_rule_1 = require("./rules/FilterHermesTrace.rule");
|
|
21
|
+
const FilterInternalNodeTrace_rule_1 = require("./rules/FilterInternalNodeTrace.rule");
|
|
22
|
+
const FilterPendingActivitiesTrace_rule_1 = require("./rules/FilterPendingActivitiesTrace.rule");
|
|
23
|
+
const FilterShadowRootTrace_rule_1 = require("./rules/FilterShadowRootTrace.rule");
|
|
24
|
+
const FilterStyleEngineTrace_rule_1 = require("./rules/FilterStyleEngineTrace.rule");
|
|
25
|
+
const list = [
|
|
26
|
+
new FilterHermesTrace_rule_1.FilterHermesTraceRule(),
|
|
27
|
+
new FilterInternalNodeTrace_rule_1.FilterInternalNodeTraceRule(),
|
|
28
|
+
new FilterShadowRootTrace_rule_1.FilterShadowRootTraceRule(),
|
|
29
|
+
new FilterStyleEngineTrace_rule_1.FilterStyleEngineTraceRule(),
|
|
30
|
+
new FilterPendingActivitiesTrace_rule_1.FilterPendingActivitiesTraceRule(),
|
|
31
|
+
new FilterDOMNodeChainTrace_rule_1.FilterDOMNodeChainTraceRule(),
|
|
32
|
+
new FilterAttachedDOMToDetachedDOMTrace_rule_1.FilterAttachedDOMToDetachedDOMTraceRule(),
|
|
33
|
+
new FilterCppRootsToDetachedDOMTrace_rule_1.FilterCppRootsToDetachedDOMTraceRule(),
|
|
34
|
+
];
|
|
35
|
+
exports.default = (0, InternalValueSetter_1.setInternalValue)(list, __filename, Constant_1.default.internalDir);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
* @oncall web_perf_infra
|
|
9
|
+
*/
|
|
10
|
+
import type { LeakTracePathItem } from '../../Types';
|
|
11
|
+
import { ILeakTraceFilterRule, LeakTraceFilterOptions, TraceDecision } from '../BaseTraceFilter.rule';
|
|
12
|
+
export declare class FilterAttachedDOMToDetachedDOMTraceRule implements ILeakTraceFilterRule {
|
|
13
|
+
filter(p: LeakTracePathItem, options?: LeakTraceFilterOptions): TraceDecision;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=FilterAttachedDOMToDetachedDOMTrace.rule.d.ts.map
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*
|
|
8
|
+
* @format
|
|
9
|
+
* @oncall web_perf_infra
|
|
10
|
+
*/
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.FilterAttachedDOMToDetachedDOMTraceRule = void 0;
|
|
16
|
+
const Config_1 = __importDefault(require("../../Config"));
|
|
17
|
+
const Utils_1 = __importDefault(require("../../Utils"));
|
|
18
|
+
const BaseTraceFilter_rule_1 = require("../BaseTraceFilter.rule");
|
|
19
|
+
class FilterAttachedDOMToDetachedDOMTraceRule {
|
|
20
|
+
filter(p, options = {}) {
|
|
21
|
+
var _a;
|
|
22
|
+
const curConfig = (_a = options.config) !== null && _a !== void 0 ? _a : Config_1.default;
|
|
23
|
+
// if the path consists of only DOM native nodes/elements
|
|
24
|
+
if (curConfig.hideBrowserLeak && isAttachedDOMToDetachedDOMChain(p)) {
|
|
25
|
+
return BaseTraceFilter_rule_1.TraceDecision.NOT_INSIGHTFUL;
|
|
26
|
+
}
|
|
27
|
+
return BaseTraceFilter_rule_1.TraceDecision.MAYBE_INSIGHTFUL;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.FilterAttachedDOMToDetachedDOMTraceRule = FilterAttachedDOMToDetachedDOMTraceRule;
|
|
31
|
+
// check if the path has pattern:
|
|
32
|
+
// [Attached Element] -> [InternalNode | Text]+ -> [Detached Element]
|
|
33
|
+
function isAttachedDOMToDetachedDOMChain(path) {
|
|
34
|
+
if (!path) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
let p = path;
|
|
38
|
+
let hasEncounteredAttachedNode = false;
|
|
39
|
+
// skip the rest InternalNode
|
|
40
|
+
while (p != null && p.node) {
|
|
41
|
+
if (Utils_1.default.isDetachedDOMNode(p.node)) {
|
|
42
|
+
return hasEncounteredAttachedNode;
|
|
43
|
+
}
|
|
44
|
+
// else if this is an attached node
|
|
45
|
+
if (Utils_1.default.isDOMNodeIncomplete(p.node)) {
|
|
46
|
+
hasEncounteredAttachedNode = true;
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
// else if this not a DOM element
|
|
50
|
+
hasEncounteredAttachedNode = false;
|
|
51
|
+
}
|
|
52
|
+
p = p.next;
|
|
53
|
+
}
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
* @oncall web_perf_infra
|
|
9
|
+
*/
|
|
10
|
+
import type { LeakTracePathItem } from '../../Types';
|
|
11
|
+
import { ILeakTraceFilterRule, LeakTraceFilterOptions, TraceDecision } from '../BaseTraceFilter.rule';
|
|
12
|
+
export declare class FilterCppRootsToDetachedDOMTraceRule implements ILeakTraceFilterRule {
|
|
13
|
+
filter(p: LeakTracePathItem, options?: LeakTraceFilterOptions): TraceDecision;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=FilterCppRootsToDetachedDOMTrace.rule.d.ts.map
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*
|
|
8
|
+
* @format
|
|
9
|
+
* @oncall web_perf_infra
|
|
10
|
+
*/
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.FilterCppRootsToDetachedDOMTraceRule = void 0;
|
|
16
|
+
const Config_1 = __importDefault(require("../../Config"));
|
|
17
|
+
const Utils_1 = __importDefault(require("../../Utils"));
|
|
18
|
+
const BaseTraceFilter_rule_1 = require("../BaseTraceFilter.rule");
|
|
19
|
+
class FilterCppRootsToDetachedDOMTraceRule {
|
|
20
|
+
filter(p, options = {}) {
|
|
21
|
+
var _a;
|
|
22
|
+
const curConfig = (_a = options.config) !== null && _a !== void 0 ? _a : Config_1.default;
|
|
23
|
+
// if the path contains edges from [C++ roots] to detached DOM elements
|
|
24
|
+
if (curConfig.hideBrowserLeak && hasCppRootsToDetachedDOMNode(p)) {
|
|
25
|
+
return BaseTraceFilter_rule_1.TraceDecision.NOT_INSIGHTFUL;
|
|
26
|
+
}
|
|
27
|
+
return BaseTraceFilter_rule_1.TraceDecision.MAYBE_INSIGHTFUL;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.FilterCppRootsToDetachedDOMTraceRule = FilterCppRootsToDetachedDOMTraceRule;
|
|
31
|
+
function hasCppRootsToDetachedDOMNode(path) {
|
|
32
|
+
let p = path;
|
|
33
|
+
// all the reference chain consists of DOM elements/nodes
|
|
34
|
+
while (p && p.node) {
|
|
35
|
+
if (Utils_1.default.isCppRootsNode(p.node) &&
|
|
36
|
+
p.next &&
|
|
37
|
+
p.next.node &&
|
|
38
|
+
Utils_1.default.isDOMNodeIncomplete(p.next.node)) {
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
p = p.next;
|
|
42
|
+
}
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
* @oncall web_perf_infra
|
|
9
|
+
*/
|
|
10
|
+
import type { LeakTracePathItem } from '../../Types';
|
|
11
|
+
import { ILeakTraceFilterRule, LeakTraceFilterOptions, TraceDecision } from '../BaseTraceFilter.rule';
|
|
12
|
+
export declare class FilterDOMNodeChainTraceRule implements ILeakTraceFilterRule {
|
|
13
|
+
filter(p: LeakTracePathItem, options?: LeakTraceFilterOptions): TraceDecision;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=FilterDOMNodeChainTrace.rule.d.ts.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*
|
|
8
|
+
* @format
|
|
9
|
+
* @oncall web_perf_infra
|
|
10
|
+
*/
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.FilterDOMNodeChainTraceRule = void 0;
|
|
16
|
+
const Config_1 = __importDefault(require("../../Config"));
|
|
17
|
+
const Utils_1 = __importDefault(require("../../Utils"));
|
|
18
|
+
const BaseTraceFilter_rule_1 = require("../BaseTraceFilter.rule");
|
|
19
|
+
class FilterDOMNodeChainTraceRule {
|
|
20
|
+
filter(p, options = {}) {
|
|
21
|
+
var _a;
|
|
22
|
+
const curConfig = (_a = options.config) !== null && _a !== void 0 ? _a : Config_1.default;
|
|
23
|
+
// if the path consists of only DOM native nodes/elements
|
|
24
|
+
if (curConfig.hideBrowserLeak && isDOMNodeChain(p)) {
|
|
25
|
+
return BaseTraceFilter_rule_1.TraceDecision.NOT_INSIGHTFUL;
|
|
26
|
+
}
|
|
27
|
+
return BaseTraceFilter_rule_1.TraceDecision.MAYBE_INSIGHTFUL;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.FilterDOMNodeChainTraceRule = FilterDOMNodeChainTraceRule;
|
|
31
|
+
function isDOMNodeChain(path) {
|
|
32
|
+
let p = path;
|
|
33
|
+
// all the reference chain consists of DOM elements/nodes
|
|
34
|
+
while (p && p.node) {
|
|
35
|
+
if (!Utils_1.default.isRootNode(p.node) && !Utils_1.default.isDOMNodeIncomplete(p.node)) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
p = p.next;
|
|
39
|
+
}
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
* @oncall web_perf_infra
|
|
9
|
+
*/
|
|
10
|
+
import type { LeakTracePathItem } from '../../Types';
|
|
11
|
+
import { ILeakTraceFilterRule, LeakTraceFilterOptions, TraceDecision } from '../BaseTraceFilter.rule';
|
|
12
|
+
export declare class FilterHermesTraceRule implements ILeakTraceFilterRule {
|
|
13
|
+
filter(_p: LeakTracePathItem, options?: LeakTraceFilterOptions): TraceDecision;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=FilterHermesTrace.rule.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*
|
|
8
|
+
* @format
|
|
9
|
+
* @oncall web_perf_infra
|
|
10
|
+
*/
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.FilterHermesTraceRule = void 0;
|
|
16
|
+
const Config_1 = __importDefault(require("../../Config"));
|
|
17
|
+
const BaseTraceFilter_rule_1 = require("../BaseTraceFilter.rule");
|
|
18
|
+
class FilterHermesTraceRule {
|
|
19
|
+
filter(_p, options = {}) {
|
|
20
|
+
var _a;
|
|
21
|
+
const curConfig = (_a = options.config) !== null && _a !== void 0 ? _a : Config_1.default;
|
|
22
|
+
// do not filter out paths when analyzing Hermes snapshots
|
|
23
|
+
if (curConfig.jsEngine === 'hermes') {
|
|
24
|
+
return BaseTraceFilter_rule_1.TraceDecision.INSIGHTFUL;
|
|
25
|
+
}
|
|
26
|
+
return BaseTraceFilter_rule_1.TraceDecision.MAYBE_INSIGHTFUL;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.FilterHermesTraceRule = FilterHermesTraceRule;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
* @oncall web_perf_infra
|
|
9
|
+
*/
|
|
10
|
+
import type { LeakTracePathItem } from '../../Types';
|
|
11
|
+
import { ILeakTraceFilterRule, LeakTraceFilterOptions, TraceDecision } from '../BaseTraceFilter.rule';
|
|
12
|
+
export declare class FilterInternalNodeTraceRule implements ILeakTraceFilterRule {
|
|
13
|
+
filter(p: LeakTracePathItem, options?: LeakTraceFilterOptions): TraceDecision;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=FilterInternalNodeTrace.rule.d.ts.map
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*
|
|
8
|
+
* @format
|
|
9
|
+
* @oncall web_perf_infra
|
|
10
|
+
*/
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.FilterInternalNodeTraceRule = void 0;
|
|
16
|
+
const Config_1 = __importDefault(require("../../Config"));
|
|
17
|
+
const Utils_1 = __importDefault(require("../../Utils"));
|
|
18
|
+
const BaseTraceFilter_rule_1 = require("../BaseTraceFilter.rule");
|
|
19
|
+
class FilterInternalNodeTraceRule {
|
|
20
|
+
filter(p, options = {}) {
|
|
21
|
+
var _a;
|
|
22
|
+
const curConfig = (_a = options.config) !== null && _a !== void 0 ? _a : Config_1.default;
|
|
23
|
+
// if the path has pattern: Window -> [InternalNode]+ -> DetachedElement
|
|
24
|
+
if (curConfig.hideBrowserLeak && internalNodeRetainsDetachedElement(p)) {
|
|
25
|
+
return BaseTraceFilter_rule_1.TraceDecision.NOT_INSIGHTFUL;
|
|
26
|
+
}
|
|
27
|
+
return BaseTraceFilter_rule_1.TraceDecision.MAYBE_INSIGHTFUL;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.FilterInternalNodeTraceRule = FilterInternalNodeTraceRule;
|
|
31
|
+
// check if the path has pattern:
|
|
32
|
+
// Window -> [InternalNode | Text]+ -> DetachedElement
|
|
33
|
+
function internalNodeRetainsDetachedElement(path) {
|
|
34
|
+
var _a, _b;
|
|
35
|
+
if (!path) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
let p = path;
|
|
39
|
+
// GC root is not Window
|
|
40
|
+
if (!p.node || !p.node.name.startsWith('Window')) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
p = p.next;
|
|
44
|
+
// Window is not poining to InternalNode
|
|
45
|
+
if (!p || !p.node || p.node.name !== 'InternalNode') {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
// skip the rest InternalNode
|
|
49
|
+
while (((_a = p.node) === null || _a === void 0 ? void 0 : _a.name) === 'InternalNode' || ((_b = p.node) === null || _b === void 0 ? void 0 : _b.name) === 'Text') {
|
|
50
|
+
p = p.next;
|
|
51
|
+
if (!p) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
// check if the node is a detached element
|
|
56
|
+
return p && Utils_1.default.isDetachedDOMNode(p.node);
|
|
57
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
* @oncall web_perf_infra
|
|
9
|
+
*/
|
|
10
|
+
import type { LeakTracePathItem } from '../../Types';
|
|
11
|
+
import { ILeakTraceFilterRule, LeakTraceFilterOptions, TraceDecision } from '../BaseTraceFilter.rule';
|
|
12
|
+
export declare class FilterPendingActivitiesTraceRule implements ILeakTraceFilterRule {
|
|
13
|
+
filter(p: LeakTracePathItem, options?: LeakTraceFilterOptions): TraceDecision;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=FilterPendingActivitiesTrace.rule.d.ts.map
|