Messagekit: Images instantiated with `contentsOf:` leak their path

Created on 24 Jun 2020  路  3Comments  路  Source: MessageKit/MessageKit

There's two image inits in MessageKit which cause memory leaks:

/Sources/Models/MessageStyle.swift:85:        guard var image = UIImage(contentsOfFile: path) else { return nil }
/Sources/Extensions/UIImage+Extension.swift:39:        let image = UIImage(contentsOfFile: imagePath ?? "")

According to this answer on SO, using UIImage(data: Data(contentsOf: url)) instead fixes this issue.

image
image

confirmed bug waiting for response

Most helpful comment

@martinpucik Confirmed, #1341 fixed this.
Screen Shot 2020-06-30 at 11 00 00 AM

All 3 comments

Hey @yspreen thanks for reporting this! Would you be interested in submitting a PR for this? :) No pressure

@yspreen I think this is not used anymore on development branch. Could you please check if this could be consider fixed?

@martinpucik Confirmed, #1341 fixed this.
Screen Shot 2020-06-30 at 11 00 00 AM

Was this page helpful?
0 / 5 - 0 ratings