I wrote the following code snippet to take a screenshot:
UIGraphicsBeginImageContext(animationView.frame.size); [[window layer] renderInContext:UIGraphicsGetCurrentContext()]; UIImage* screenshot = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext();
But, UIGraphicsGetImageFromCurrentImageContext seems to be leaking. Is it correct?
InstrumentsI was unable to obtain the exact leak point. In the activity monitor, I noticed that when I switch to a user interface that executes the code snippets described above, the code snippet is on some MB. After this moment, it never decreases. Does UIGraphicsGetImageFromCurrentImageContext have a memory leak? How to solve this?
Edit: analysis of tools Activity Monitor: shows a burst of memory when this line of code is executed; never decreases even after taking a screenshot (UIImage)
Leaks and distribution, heap Snapshot: does not show leaks or this distribution.
Can someone help me?
source share