Warning: Undefined array key "pathway" in /home/clients/160b20c93964292618c158d21ce27bf5/sites/tech.org-services.ch/wp-content/themes/Newspaper/functions.php on line 543
Monday, December 5, 2022
HomeiOS Developmentios - Swift Reminiscence Leaks with UIDiffableDataSource, CFString, Malloc Blocks, and others

ios – Swift Reminiscence Leaks with UIDiffableDataSource, CFString, Malloc Blocks, and others


I have been writing an utility for a pair months now and simply began checking for reminiscence leaks – it seems I’ve a number of them – 25 distinctive sorts (purple exclamation level) and over 500 complete if I navigate by way of my app sufficient.

The Reminiscence Graph in Xcode is pointing largely to 1.) completely different parts of UIDiffableDataSource, 2.) “CFString”/”CFString (Storage)”, and three.) “Malloc Blocks”. The Leaks Instrument is giving me comparable suggestions, saying about 90% of my reminiscence leaks are these “Malloc Blocks” and likewise says the Accountable Body is both newJSONString or newJSONValue. In most of the leaks there’s a “4-node-cycle” concerned which accommodates a Swift Closure Context, My UIDiffableDataSource<Merchandise, Part> object, and __UIDiffableDataSource. The CFString ones simply have one object – CFString, and nothing else. I am going to attempt to add pictures exhibiting the two examples, however StackO is proscribing my skill so as to add them as a result of I am a n00b.

This leads me to imagine I am creating some sort of reminiscence leak inside my customized dataSource closure for the UICollectionViewDiffableDataSource. I’ve tried making the DataSource a weak var & I’ve tried utilizing weak self and unowned self in every of my closures — particularly the closure creating my datasource, but it surely’s had no impression.

  • What does it imply when Reminiscence Graph/Leaks Instrument level to those generic “CFString” or “Malloc Block” objects?
  • Does anybody have an thought of what would possibly truly be inflicting these reminiscence leaks and the way I can resolve them?
  • Do reminiscence graph and Leaks instrument ever false report leaks/create pointless noise or are these authentic?

any additional information or extra sources could be tremendous useful. Thus far I’ve discovered iOS Academy & Mark Moeykens YouTube movies useful in understanding the fundamentals, however having bother making use of it to my app. I can present code blocks if that helps, however there may be a number of code that might be inflicting it and probably not certain what all to dump in right here.

overview of errors

4 node cycle (diffableDataSource)

CFString (Storage)

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments