Skip to content

Commit d1fa975

Browse files
committed
fix: gc frames stacking on each other incorrectly
1 parent 90296c3 commit d1fa975

File tree

1 file changed

+6
-1
lines changed
  • packages/vscode-js-profile-flame/src/client

1 file changed

+6
-1
lines changed

packages/vscode-js-profile-flame/src/client/stacks.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ export const buildColumns = (model: IProfileModel) => {
171171
}
172172

173173
// 2. Merge them
174+
let lastFrameWasGc = false;
174175
for (let x = 1; x < columns.length; x++) {
175176
const col = columns[x];
176177
const root = col.rows[0] as IColumnLocation;
@@ -179,10 +180,14 @@ export const buildColumns = (model: IProfileModel) => {
179180
// show GC on top of the previous frame. Matches what chrome devtools do.
180181
if (col.rows.length === 1 && x > 0 && root.callFrame.functionName === Constants.GcFunction) {
181182
col.rows = columns[x - 1].rows.map(row => (typeof row === 'number' ? row : x - 1));
182-
col.rows.push(root);
183+
if (!lastFrameWasGc) {
184+
col.rows.push(root);
185+
lastFrameWasGc = true;
186+
}
183187
continue;
184188
}
185189

190+
lastFrameWasGc = false;
186191
for (let y = 0; y < col.rows.length; y++) {
187192
const current = col.rows[y] as IColumnLocation;
188193
const prevOrNumber = columns[x - 1]?.rows[y];

0 commit comments

Comments
 (0)