Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do I need to release the context returned from UIGraphicsGetCurrentContext()?

Tags:

I am using CGContextRef.

UIGraphicsBeginImageContext(self.drawImage.frame.size);
CGContextRef context=UIGraphicsGetCurrentContext();
CGContextSetRGBStrokeColor(context,0.0f,0.0f,0.0f,1.0f);
UIGraphicsEndImageContext();
CGContextRelease(context);

Do I need to call CGContextRelease(Context); in the above one.

like image 654
kiran Avatar asked Sep 16 '10 10:09

kiran


1 Answers

No.

See The Create Rule vs. The Get Rule:

The Create Rule

Core Foundation functions have names that indicate when you own a returned object:

Object-creation functions that have “Create” embedded in the name; Object-duplication functions that have “Copy” embedded in the name.

[...]

The Get Rule

If you receive an object from any Core Foundation function other than a creation or copy function—such as a Get function—you do not own it [...]

like image 163
Nikolai Ruhe Avatar answered Sep 22 '22 07:09

Nikolai Ruhe