jeffrey
jeffrey

Reputation: 183

I dont know CFRelease(CFTypeRef cf) usage when i using the Core Text

Using the Core Text, i dont know when should i call the release function:

void CFRelease ( CFTypeRef cf );

should i call above function passing following parameters:

CGContextRef contextRef;

CGMutablePathRef leftColumnPath;

Upvotes: 0

Views: 1440

Answers (1)

onevcat
onevcat

Reputation: 4631

You should not call CFRelease unless you create/copy them.

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. If you own an object, it is your responsibility to relinquish ownership (using CFRelease) when you have finished with it.

So if you use some CF method in which contains "Copy" or "Create", you should call CFRelease on them. Else you can just use them.

Upvotes: 1

Related Questions