WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
215729
Memory leak issue for WKWebView:evaluateJavaScript
https://bugs.webkit.org/show_bug.cgi?id=215729
Summary
Memory leak issue for WKWebView:evaluateJavaScript
Michael Kreitmann
Reported
2020-08-21 04:11:04 PDT
Created
attachment 407008
[details]
Xcode project to reproduce the issue When calling evalueJavaScript function with a large String (i.e. a 100MB String) as show below, WebView will always hold a reference to this large string (allocating memory) and will not release the memory. Executing this code several times, will cause WebKit task to crash (due to memory issues) and will restart. __block NSString *script = [NSString stringWithFormat:@"//%@", [@"" stringByPaddingToLength:100*1024*1024 withString: @"?" startingAtIndex:0]]; [weakWebView evaluateJavaScript:script completionHandler:nil]; See attached Xcode project to reproduce the issue.
Attachments
Xcode project to reproduce the issue
(753.34 KB, application/zip)
2020-08-21 04:11 PDT
,
Michael Kreitmann
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2020-08-22 16:11:20 PDT
<
rdar://problem/67625708
>
Danesz
Comment 2
2021-11-16 12:29:35 PST
Unfortunately the problem is still present, so I have implemented a PoC to overcome this issue.
https://github.com/Danesz/Sidewalk
Sidewalk is available as a Swift package. Also a sample app with the proof of the leak:
https://github.com/Danesz/SidewalkExample
Eric Slosser
Comment 3
2023-01-10 11:54:15 PST
seems fixed in iOS 16.2
Palaneappan K Rajalingam
Comment 4
2024-06-20 20:33:00 PDT
This issue still exists. I am able to reproduce the similar issue in safari browser. However, the memory issue doesn't occur in other web browsers though.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug