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

Memory spike in pb_takeSnapshot function #46

Open
Jackson0111 opened this issue Jun 22, 2016 · 2 comments
Open

Memory spike in pb_takeSnapshot function #46

Jackson0111 opened this issue Jun 22, 2016 · 2 comments

Comments

@Jackson0111
Copy link

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.

@MohammedBadr20s
Copy link

and it crashes too

@MohammedBadr20s
Copy link

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()
}

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

No branches or pull requests

2 participants