NEW 237652
WKUserContentController.add(_:name:) leads to memory leak even if wrap the object into a weak reference wrapper
https://bugs.webkit.org/show_bug.cgi?id=237652
Summary WKUserContentController.add(_:name:) leads to memory leak even if wrap the ob...
Daohan Chong
Reported 2022-03-09 06:01:00 PST
From our developer side, adding user script will unexpectedly leak the WKUserScript object even if the WKWebView instance is deallocated. Proof: https://twitter.com/WildCat_io/status/1501547346416799746 Workaround of this bug: To remove all message handlers when the WKWebView is deallocated: https://github.com/Lakr233/XTerminalUI/blob/3204296353e8874020c834cc70343f73ad4ecdf9/Sources%2FXTerminalUI%2FXTerminalWebViewDelegate.swift#L26 (It can also be put into WKWebView.deinit). It can be reproduced on both iOS 15 and macOS 12 (catalyst).
Attachments
Demo project (50.00 KB, application/x-gzip)
2022-03-10 06:05 PST, Daohan Chong
no flags
Daohan Chong
Comment 1 2022-03-10 06:05:39 PST
Created attachment 454352 [details] Demo project
Radar WebKit Bug Importer
Comment 2 2022-03-10 10:21:21 PST
Daohan Chong
Comment 3 2022-03-18 01:49:23 PDT
Note You need to log in before you can comment on or make changes to this bug.