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

Prevent a memory leak when converting to JSON #351

Merged
merged 1 commit into from
Jan 18, 2018

Conversation

shaneomack91
Copy link
Contributor

The use of JSONObjectWithData in these methods leaks 4KB each time when used for sending plugin results. Wrapping them in an autoreleasepool fixes this problem with no noticeable detrimental effects on performance.

Platforms affected

iOS

What does this PR do?

Fixes a memory leak in CDVJSONSerializingPrivate methods

What testing has been done on this change?

Using Instruments app on Mac, observed a 4KB increase in memory usage every time these methods were called that does not get released throughout the lifetime of the app. After implementing these changes, the memory usage remains stable.

The use of JSONObjectWithData in these methods leaks 4KB each time when used for sending plugin results. Wrapping them in an autoreleasepool fixes this problem with no noticeable detrimental effects on performance.
@codecov-io
Copy link

Codecov Report

Merging #351 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #351   +/-   ##
=======================================
  Coverage   63.45%   63.45%           
=======================================
  Files          14       14           
  Lines        1691     1691           
  Branches      284      284           
=======================================
  Hits         1073     1073           
  Misses        618      618

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4f873f7...e4c162b. Read the comment docs.

@purplecabbage purplecabbage merged commit c88fbbf into apache:master Jan 18, 2018
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.

4 participants