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

(ios) fix: memory leak when removing the CDVViewController #1326

Merged
merged 1 commit into from
May 20, 2023

Conversation

cbernier
Copy link
Contributor

Platforms affected

iOS

Motivation and Context

I am using Cordova inside a React Native application so I often need to destroy and re-create the CDVViewController.

Description

Since I am using a custom scheme, it is leaking (the CDVViewController is never deallocated despite being remove from its parentViewController)

Testing

I confirm that by changing strong to weak, the CDVViewController is deallocated as soon as it is removed from its parent view controller.

Checklist

  • [yes] I've run the tests to see all new and existing tests pass
  • [no] I added automated test coverage as appropriate for this change
  • [yes ] Commit is prefixed with (platform) if this change only applies to one platform (e.g. (android))
  • [no ] If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct keyword to close issues using keywords)
  • [no ] I've updated the documentation if necessary

@dpogue
Copy link
Member

dpogue commented May 19, 2023

This sounds like it solves #1071, right?

And then #920 is a different, unrelated memory leak?

@dpogue dpogue added this to the 7.0.0 milestone May 19, 2023
@cbernier
Copy link
Contributor Author

Oh right, it should fix those 2 issues, at least for me there's no more leak: both the webView and view controller get deallocated.

@codecov-commenter
Copy link

codecov-commenter commented May 19, 2023

Codecov Report

Merging #1326 (7c5ff48) into master (c000a1b) will decrease coverage by 0.04%.
The diff coverage is 66.66%.

@@            Coverage Diff             @@
##           master    #1326      +/-   ##
==========================================
- Coverage   78.64%   78.61%   -0.04%     
==========================================
  Files          15       15              
  Lines        1789     1791       +2     
==========================================
+ Hits         1407     1408       +1     
- Misses        382      383       +1     
Impacted Files Coverage Δ
lib/create.js 94.59% <66.66%> (-1.24%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@dpogue dpogue linked an issue May 19, 2023 that may be closed by this pull request
@dpogue dpogue merged commit 8672b5d into apache:master May 20, 2023
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.

memory leak for hybrid apps with more than one CDVViewController
3 participants