Application is leaking Browser instances

RESOLVED FIXED

Status

()

Firefox for iOS
General
RESOLVED FIXED
3 years ago
2 years ago

People

(Reporter: st3fan, Assigned: bnicholson)

Tracking

({perf})

unspecified
Other
iOS

Firefox Tracking Flags

(fennec+)

Details

Attachments

(1 attachment)

(Reporter)

Description

3 years ago
I added a a deinit to Browser:

    deinit {
        println("Hi! I am deinit!")
    }

But it is never called. Which means we are leaking Browser instances and thus also WKWebView instances.
(Reporter)

Updated

3 years ago
Summary: Leaking Browser instances → Applicaiton is leaking Browser instances
(Reporter)

Updated

3 years ago
Summary: Applicaiton is leaking Browser instances → Application is leaking Browser instances
(Reporter)

Comment 1

3 years ago
I think the actual problem is that we are holding a reference to the Browser.webView somewhere.

The Browser is a WKScriptMessageHandler so it's WKWebView has a reference to Browser. That is fine because the webview is released when the Browser is released. But! If something outside of Browser is keeping a reference to the WKWebView then that release will not happen.

Updated

3 years ago
Keywords: perf
(Reporter)

Comment 2

3 years ago
This also contributes to the startup time I think, according to WebKit bug https://bugs.webkit.org/show_bug.cgi?id=142583
WKScriptMessage.initWithBody:webView:frameInfo:name leaks an NSDictionary each time we open a new tab.

I can't see what's in that dict, but perhaps it's the WKSMH…
Blocks: 1146361
tracking-fennec: ? → +
(Assignee)

Updated

2 years ago
Assignee: nobody → bnicholson
Status: NEW → ASSIGNED
(Assignee)

Comment 4

2 years ago
Created attachment 8612625 [details] [review]
Link to Github pull-request: https://github.com/mozilla/firefox-ios/pull/521
Attachment #8612625 - Flags: review?(sarentz)
(Assignee)

Updated

2 years ago
No longer blocks: 1146361
(Reporter)

Comment 5

2 years ago
Comment on attachment 8612625 [details] [review]
Link to Github pull-request: https://github.com/mozilla/firefox-ios/pull/521

Great fix.
Attachment #8612625 - Flags: review?(sarentz) → review+
(Assignee)

Comment 6

2 years ago
https://github.com/mozilla/firefox-ios/commit/e00109f05a873867ed48a0ba3391b6b99fe2fb5f
Status: ASSIGNED → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.