folding-cell icon indicating copy to clipboard operation
folding-cell copied to clipboard

Memory spike in pb_takeSnapshot function

Open Jackson0111 opened this issue 9 years ago • 2 comments

Hey there! Love the work! Noticed some unusual memory behavior. screen shot 2016-06-22 at 10 19 52 am

The memory usage increases by a lot every time I tap to open a cell (which will then load images with SDWebImage, as well as other data from the server), but it never comes down. Now, I understand dealing with images is expensive, but is there a way to work around this issue? Please let me know what you think.

Jackson0111 avatar Jun 22 '16 14:06 Jackson0111

and it crashes too

MohammedBadr20s avatar Oct 16 '19 01:10 MohammedBadr20s

This Code solves it and so much faster func takeSnapshot(_ frame: CGRect) -> UIImage? { UIGraphicsBeginImageContextWithOptions(frame.size, false, 0) defer { UIGraphicsEndImageContext() } self.drawHierarchy(in: self.bounds, afterScreenUpdates: true) return UIGraphicsGetImageFromCurrentImageContext() }

MohammedBadr20s avatar Oct 16 '19 02:10 MohammedBadr20s