Bug 264370

Summary: Consistent exceeded_mem_limit crashes on nypost.com
Product: WebKit Reporter: Dustin <dustin>
Component: New BugsAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: jklein, rik, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari 17   
Hardware: iPhone / iPad   
OS: iOS 17   
Attachments:
Description Flags
evidence of memory usage accumulating between refreshes none

Description Dustin 2023-11-07 15:29:49 PST
Created attachment 468509 [details]
evidence of memory usage accumulating between refreshes

I'm a dev working on nypost.com, and we're seeing consistent exceeded_mem_limit crashes on mobile webkit devices on any given page such as
https://nypost.com/2023/10/11/australian-swimmers-almost-walk-into-shark-as-it-swims-close-to-shore/

Example system log message (iPhone SE 3rd gen):
default	12:41:46.422774-0400	kernel	EXC_RESOURCE -> com.apple.WebKit.WebContent[46857] exceeded mem limit: InactiveSoft 1536 MB (non-fatal)

Monitoring memory usage via the timelines panel, we see memory usage climb until it hits ~1.5GB, at which point we get the crash and the system log message.

To reproduce:

1. connect a physical iPhone to the dev tools on a macbook, open the timelines panel with the memory profiler enabled. 
2. load nypost.com articles such as the one above. reloading one article over and over will suffice.
3. observe one or both of the following behaviors:
  3a. The initial level of memory in use rises between refreshes/pageloads (a rising floor)
  3b. Memory usage reported by the profiler rises until it hits the limit of your device (the crash is observed here)

All investigation thus far points toward the simplest explanation that there is simply too much JS competing for the same resources, except for the attached video which shows memory usage increasing between page refreshes. 
The video shows a series of page reloads made with a few dozen blocked network requests via local overrides panel (available upon request), hence the short load time. The memory footprint shown starts around 700 MB, and with nothing changed between reloads, the memory footprint increases to 1.5GB after around 40 reloads. 

Could this be a bug in webkit?

Some initial discussion in slack begins here:
https://webkit.slack.com/archives/CU5LWFM28/p1698337009660529

Thank you!

Macbook Pro - Ventura 13.3, Safari 16.4
iPhone SE 3rd gen - 17.1
Comment 1 Radar WebKit Bug Importer 2023-11-07 16:27:42 PST
<rdar://problem/118087036>
Comment 2 John Klein 2023-11-16 14:40:33 PST
We have also seen this memory issue happening to iOS users on our site ranker.com and have talked with other digital publishers that are also all seeing the same issue.