Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix various memory leaks caused by capturing self #60

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

jhong70
Copy link

@jhong70 jhong70 commented Aug 25, 2023

Summary of changes

  • There are various points in POPPopupBridge.swift where self is captured and retained. This causes POPPopupBridge and web views to leak. This change addresses those issues by passing in self as weak reference. Additionally we prevent leaks from using WKScriptMessageHandler by creating a proxy object that weekly retains the handler.

Checklist

  • Added a changelog entry

Authors

Joon Hong

@jhong70 jhong70 marked this pull request as ready for review August 25, 2023 17:21
@jhong70 jhong70 requested a review from a team as a code owner August 25, 2023 17:21
@scannillo
Copy link
Contributor

Hi @jhong70, thank you for opening this PR! Can you provide some more specifics on between which two objects you're seeing a retain cycle as well as steps for how we can replicate this leak?

@via-guy
Copy link

via-guy commented Dec 10, 2023

@scannillo I recently fixed a memory leak in my project for webView.configuration.userContentController.add, which retains the handler. It was very difficult to debug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants