Let's say I have this piece of code:
CGColorSpaceRef colorSpaceRGB = CGColorSpaceCreateDeviceRGB();
CGContextSetStrokeColorSpace(context, colorSpaceRGB);
CGContextSetFillColorSpace(context, colorSpaceRGB);
After that I do some drawing. When I'm done,
do I need to manually release colorSpaceRGB
if I'm using ARC? Like this:
CGColorSpaceRelease(colorSpaceRGB);
Or I don't need to do anything?
Thanks :)
Yes. According to Apple's doc: Because CGColorSpaceRelease function is equivalent to CFRelease, except that it does not cause an error if the cs parameter is NULL. And if you create, copy, or explicitly retain a Core Foundation object, you are responsible for releasing it when you no longer need it (see Memory Management Programming Guide for Core Foundation).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With