Skip to content

Commit afcc464

Browse files
committed
should switch first snap correctly
1 parent 1f5bb22 commit afcc464

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

internal/perf/src/heapsnapshot.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ export async function leakingObjectsInHeapSnapshotFiles(
4141
const aggregates = baseSnap.aggregatesForDiff(defs);
4242
const snapshotDiff = snap.calculateSnapshotDiff('', aggregates);
4343

44+
// next base snap is this/current snap
45+
baseSnap = snap;
46+
4447
const growingDiff: HeapSnapshotDiff = {};
4548
for (const { addedIndexes, deletedIndexes, ...diff } of Object.values(
4649
snapshotDiff,
@@ -81,8 +84,6 @@ export async function leakingObjectsInHeapSnapshotFiles(
8184
delete totalGrowingDiff[totalDiffName];
8285
}
8386
}
84-
85-
baseSnap = snap;
8687
}
8788

8889
return totalGrowingDiff;

internal/perf/tests/heapsnapshot.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ it.skipIf(
5151
.toMatchInlineSnapshot(`
5252
{
5353
"(compiled code)": {
54-
"addedCount": 24267,
55-
"addedSize": 4981944,
56-
"countDelta": -19747,
54+
"addedCount": 16020,
55+
"addedSize": 3015968,
56+
"countDelta": -9728,
5757
"name": "(compiled code)",
58-
"removedCount": 44014,
59-
"removedSize": 2541944,
60-
"sizeDelta": 2440000,
58+
"removedCount": 25748,
59+
"removedSize": 1731144,
60+
"sizeDelta": 1284824,
6161
},
6262
}
6363
`);

0 commit comments

Comments
 (0)