3

When XCode analyzes my code, it finds potential memory leaks. I use ARC, but I learned that ARC doesn't handle C types. Since I use CGImageRef in order to create UIImage with it and assign to UIImageView.image property, When is it appropriate to release CGImageRef? Can I release it right after I create a new UIImage with it? If I release the CGImageRef, then does it make my UIImage instance also invalid?

Midhun MP
  • 103,496
  • 31
  • 153
  • 200
neo
  • 1,952
  • 2
  • 19
  • 39

1 Answers1

3

UIImageView retains the image property (if it needs it) or it copies it - whatever. Once you have set that property, you can then immediately release the CGImageRef.

David H
  • 40,852
  • 12
  • 92
  • 138