Bug 212201

Summary: [css-grid] WPT test css/css-grid/grid-definition/grid-limits-001.html is very slow and uses too much RAM
Product: WebKit Reporter: Carlos Alberto Lopez Perez <clopez>
Component: CSSAssignee: Matt Woodrow <mattwoodrow>
Status: RESOLVED FIXED    
Severity: Normal CC: changseok, dino, esprehn+autocc, ews-watchlist, glenn, jfernandez, kondapallykalyan, mattwoodrow, obrufau, pdr, rego, svillar, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Carlos Alberto Lopez Perez 2020-05-21 05:26:27 PDT
The WPT test css/css-grid/grid-definition/grid-limits-001.html is very slow when executed in WebKit and uses too much RAM.

Sometimes it even crashes for me with this loud error coming from the WebProcess:

"Unable to shrink memory footprint of process (9248 MB) below the kill thresold (4096 MB). Killed"


The issue its both reproducible, either by running our imported layout test imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-limits-001.html (I'm importing it on bug 212187) or by running the upstream wpt test from https://wpt.live/css/css-grid/grid-definition/grid-limits-001.html

You can see how the tests takes a while to execute (like 10-20 seconds) and the memory usage peaks around 9GB !

This issue its not reproducible with chrome or firefox:

 - with Chrome the test executes quickly, uses few RAM (~250M) but it fails the tests
 - with Firefox the test executes quickly, uses few RAM (~400M) and it passes ok.
Comment 1 Manuel Rego Casasnovas 2020-05-21 06:27:35 PDT
This is somehow expected, given the current memory structure in WebKit:
  typedef Vector<Vector<GridCell>> GridAsMatrix;

For very big grids we create cells for all the nodes and that's too many elements.

In Chromium we use a different memory structure, that we could eventually port into WebKit, but it's not a simple task at all (despite we could re-use most of Blink code for that).
Comment 2 Radar WebKit Bug Importer 2022-01-20 09:10:38 PST
<rdar://problem/87832267>
Comment 3 Matt Woodrow 2022-03-13 20:49:32 PDT
Created attachment 454563 [details]
Patch
Comment 4 EWS 2022-03-27 13:25:13 PDT
Committed r291952 (248919@main): <https://commits.webkit.org/248919@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 454563 [details].