RESOLVED INVALID264907
WPE / cog potential memory leak
https://bugs.webkit.org/show_bug.cgi?id=264907
Summary WPE / cog potential memory leak
Marek Vasut
Reported 2023-11-15 16:31:04 PST
When viewing JS/CSS example https://codepen.io/anon/embed/rNMprwo ( first example from https://css-tricks.com/how-to-play-and-pause-css-animations-with-css-custom-properties/ ) using WPE/cog on i.MX8M with Weston 12.0.y , the WPE process grows by some 1 MiB every minute. Eventually, the system would run out of memory and the WPE process is stopped using OOM . Invocation is ' $ cog https://codepen.io/anon/embed/rNMprwo ' This happens with both WPE 2.40.5 from meta-webkit as well as recent e99d13b4e5e1 ("[WGSL] Add validation to integer modulo https://bugs.webkit.org/show_bug.cgi?id=264603 rdar://118239748") . I am not able to reproduce it with matching desktop WebkitGTK builds. Currently I am looking for a way to narrow the leak down, is there some tool for that purpose that would be part of Webkit ?
Attachments
Marek Vasut
Comment 1 2023-11-15 16:32:52 PST
Furthermore, mesa 23.2.1 (etnaviv driver, so gles2), Linux 6.1.62 (mainline + a couple of DT patches).
Philippe Normand
Comment 2 2023-11-16 00:02:41 PST
> Currently I am looking for a way to narrow the leak down, is there some tool for that purpose that would be part of Webkit ? I'm not aware of specific tooling for this. Would be nice to have though!
Michael Catanzaro
Comment 3 2023-11-16 05:41:10 PST
I understand people generally try to debug such issues using sysprof, or maybe massif. (That said, I don't think I've ever successfully debugged an issue like this ever, so....)
Marek Vasut
Comment 4 2023-11-18 21:53:46 PST
This turned out to be a memory leak in Cairo 1.16.y , fixed in 1.18.y , see https://gitlab.freedesktop.org/cairo/cairo/-/issues/805 and similar fixes in the Cairo git tree. Thanks for all the input. Massif helped narrow it down in the end. Resolved . For future reference: $ valgrind --tool=massif --depth=8 --trace-children=yes cog http://link ... $ ms_print massif.out.20 -------------------------------------------------------------------------------- Command: /usr/libexec/wpe-webkit-1.1/WPEWebProcess 10 24 Massif arguments: --depth=8 ms_print arguments: massif.out.20 -------------------------------------------------------------------------------- MB 121.2^ # | @@@# | :@@@@@# | @@@:::@@@@@# | :::@@ :::@@@@@# | @:@@:: @@ :::@@@@@# | :@@:@:@ :: @@ :::@@@@@# | @@@@::@ :@:@ :: @@ :::@@@@@# | :::@@ @::@ :@:@ :: @@ :::@@@@@# | :::::::@@ @::@ :@:@ :: @@ :::@@@@@# | ::::: : :::@@ @::@ :@:@ :: @@ :::@@@@@# | @::::: ::: : :::@@ @::@ :@:@ :: @@ :::@@@@@# | :::@: ::: ::: : :::@@ @::@ :@:@ :: @@ :::@@@@@# | @:::::: @: ::: ::: : :::@@ @::@ :@:@ :: @@ :::@@@@@# | @::@::: :: @: ::: ::: : :::@@ @::@ :@:@ :: @@ :::@@@@@# | @@@:@: @::: :: @: ::: ::: : :::@@ @::@ :@:@ :: @@ :::@@@@@# | @@::@@ :@: @::: :: @: ::: ::: : :::@@ @::@ :@:@ :: @@ :::@@@@@# | :::::@ : @@ :@: @::: :: @: ::: ::: : :::@@ @::@ :@:@ :: @@ :::@@@@@# | :::: :::@ : @@ :@: @::: :: @: ::: ::: : :::@@ @::@ :@:@ :: @@ :::@@@@@# | : :: :::@ : @@ :@: @::: :: @: ::: ::: : :::@@ @::@ :@:@ :: @@ :::@@@@@# 0 +----------------------------------------------------------------------->Ti 0 1.022 ... 74.04% (21,015,725B) (heap allocation functions) malloc/new/new[], --alloc-fns, etc. ->31.00% (8,799,962B) 0x9F5CDFD: strdup (strdup.c:42) | ->20.62% (5,851,900B) 0xA0CA5C3: _cairo_font_options_init_copy (cairo-font-options.c:90) | | ->10.31% (2,925,825B) 0xA105792: _cairo_scaled_font_init_key (cairo-scaled-font.c:665) | | | ->10.31% (2,925,825B) 0xA105792: cairo_scaled_font_create (cairo-scaled-font.c:1064) ...
Note You need to log in before you can comment on or make changes to this bug.