playwright/packages/trace-viewer/src
Simon Knott b3d767fa14
fix(trace viewer): fix memory leak (#32379)
In the `visit` method, we currently cache the rendered HTML for every
walked node. This re-use works well for traces that consist mostly of
references to earlier snapshots.
But for traces that don't share much, this is a large memory overhead
and leads to the memory crash documented in
https://github.com/microsoft/playwright/issues/32336. For the algocracks
amongst you, the current memory usage for an html tree $h$ is
$\mathcal{O}(|h| * \text{height}(h))$.

This PR removes that cache from the nodes and replaces it with a
snapshot-level cache, fixing the memory crash.
Traces *without* reference should not see a performance impact from
this.
Traces *with* references will have slower initial rendering, but
re-rendering maintains speed because of the snapshot-level cache.

Closes https://github.com/microsoft/playwright/issues/32336

---------

Signed-off-by: Simon Knott <info@simonknott.de>
Co-authored-by: Max Schmitt <max@schmitt.mx>
2024-09-04 09:57:15 +02:00
..
ui fix(ui-mode): format request body when headers are lower case (#32395) 2024-08-30 16:21:51 +02:00
versions chore(trace): add context create event for test runner (#30697) 2024-05-14 09:00:33 -07:00
DEPS.list chore: introduce testInfo.testId (#21670) 2023-03-14 15:58:55 -07:00
embedded.tsx chore(ui): update to react 18 (#32079) 2024-08-12 13:50:11 +02:00
entries.ts fix: match client step and server action by explicit stepId (#30641) 2024-05-14 12:10:46 -07:00
geometry.ts chore: migrate trace-viewer and recorder to vite (#13076) 2022-03-25 14:12:00 -07:00
index.tsx chore(ui): update to react 18 (#32079) 2024-08-12 13:50:11 +02:00
multimap.ts chore: move protocol and trace types into the top-level packages (#17486) 2022-09-20 18:41:51 -07:00
progress.ts chore: roll @zip.js/zip.js to 2.7.29 (#27047) 2023-09-13 18:39:10 +02:00
snapshotRenderer.ts fix(trace viewer): fix memory leak (#32379) 2024-09-04 09:57:15 +02:00
snapshotServer.ts fix(trace viewer): do not serve resources with x-unknown content type (#32219) 2024-08-19 10:29:51 -07:00
snapshotStorage.ts fix(snapshots): match resources by method (#24145) 2023-07-10 20:04:48 -07:00
sw.ts fix(trace): make sure the correct attachment name is used for downloads (#31928) 2024-07-31 06:20:36 -07:00
traceModel.ts fix(trace viewer): do not serve resources with x-unknown content type (#32219) 2024-08-19 10:29:51 -07:00
traceModelBackends.ts Revert "feat(trace): allow Trace Viewer to include credentials when fetching traces cross-origin (#28502)" (#29024) 2024-01-17 10:40:58 -08:00
traceModernizer.ts fix(trace): make sure the correct attachment name is used for downloads (#31928) 2024-07-31 06:20:36 -07:00
uiMode.tsx chore(ui): update to react 18 (#32079) 2024-08-12 13:50:11 +02:00
vite-env.d.ts chore: migrate trace-viewer and recorder to vite (#13076) 2022-03-25 14:12:00 -07:00