7

I'm having an issue with iOS while using CGImageDestinationFinalize. I'll call CGImageDestinationFinalize on a CGImageDestinationRef and I'll get the following warning

Error: The function `CGContextClear' is obsolete and will be removed in an upcoming update. Unfortunately, this application, or a library it uses, is using this obsolete function, and is thereby contributing to an overall degradation of system performance.

Looking at Instruments, my memory usage shoots up (sometimes it gets so high that it crashes) when I call CGImageDestinationFinalize. I'm not sure if this issue is to blame or not, but I've isolated it to being an issue with CGImageDestinationFinalize

Any advice on what to use to avoid calling a CGContextClear? Or how to reduce memory usage with CGImageDestinationFinalize?

Zachary Orr
  • 1,724
  • 1
  • 15
  • 25
  • 1
    I'm having the same problem. I just filed an Apple radar bug on the topic, and would suggest you do the same thing. – Duncan C Feb 21 '13 at 14:16
  • @DuncanC did this ever get fixed? I am still getting the same error – Jonathan Apr 18 '13 at 05:41
  • I got the same issue with CGImageDestinationFinalize in iOS 6, but no such warning in iOS 7, maybe that's because what the message had promised that it will be removed from a "future" version. So maybe the only thing we can do now is live with this warning message until everybody moves to iOS 7? – CodeBrew Oct 17 '13 at 04:16

1 Answers1

0

I would say it definitively is related to CGContextClear. It's keeping whatever you are drawing on memory. While your context doesn't get cleared or released it will keep the elements defined within that context in memory. Which version of iOS are you working with?
I'm pretty sure CGContextClear doesn't work for iOS 6 and later.

If you go to the documentation you can notice that CGContextClear doesn't appear anymore https://developer.apple.com/library/ios/DOCUMENTATION/GraphicsImaging/Reference/CGContext/Reference/reference.html

Look for CGContextClearRect that might help to your purposes

artud2000
  • 544
  • 4
  • 9