react-native-svg icon indicating copy to clipboard operation
react-native-svg copied to clipboard

Fix memory leak of a CGPathRef

Open greghe opened this issue 3 years ago • 4 comments

Summary

Regarding issue #1385 Fixes memory leak of a CGPathRef.

Explain the motivation for making this change: here are some points to help you:

CGPath leaks listed in Xcode:

leaked objects

Backtrace of leaked object, identifying RNSVGUse as the object that leaked the CGPathRef:

svg leak
  • What issues does the pull request solve? Please tag them so that they will get automatically closed once the PR is merged Issue #1385

  • What is the feature? (if applicable) Memory leak fix

  • How did you implement the solution? Added a call to autorelease returned CGPathRef in line with the other implementations of getPath:

  • What areas of the library does it impact?

Test Plan

Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI.

What's required for testing (prerequisites)?

Running an app that uses react-native-svg in the Xcode debugger with malloc stack tracing enabled.

What are the steps to reproduce (after prerequisites)?

Halt the app in the debugger and examine memory graph, specifically the leaked objects filter (by clicking on the blue triangle icon)

directions

Compatibility

OS Implemented
iOS
Android

Checklist

  • [x] I have tested this on a device and a simulator
  • [ ] I added documentation in README.md
  • [ ] I updated the typed files (typescript)
  • [ ] I added a test for the API in the __tests__ folder

greghe avatar Sep 30 '21 18:09 greghe

Would be awesome if this could get merged. We are also experiencing this issue. Looks like a simple fix?

Arjan-Zuidema avatar Oct 25 '22 08:10 Arjan-Zuidema

I'd love to remove my local patch for this fix. Any idea when this will make it into a release?

markrickert avatar Aug 08 '23 18:08 markrickert

@javache hi, is there any reason why this is not merged yet? Thanks

efstathiosntonas avatar Apr 03 '24 10:04 efstathiosntonas

Hi, Could someone explain how we can reproduce that nowadays? We want to reproduce that memory leak. Thank you.

bohdanprog avatar Jul 03 '24 14:07 bohdanprog