开发者

CoreFoundation Ownership follows the CreateRule

开发者 https://www.devze.com 2023-02-27 06:01 出处:网络
What does \"Ownership 开发者_JAVA百科follows the CreateRule.\" means inside the core foundation documentation?.

What does "Ownership 开发者_JAVA百科follows the CreateRule." means inside the core foundation documentation?.

Return Value A new dictionary, or NULL if there was a problem creating the object. Ownership follows the Create Rule.

Thanks.


If you create an object, using a function with either Create or Copy in its name, you need to release it using CFRelease. If you get an object by another way, you don't have to.

Same as convenience methods in Objective-c.

Quote from "Core Foundation Design Concepts"

There is an important distinction between Get, and Copy and Create, in names of functions that return values. If you use a Get function, you cannot be certain of the returned object’s life span. To ensure the persistence of such an object you can retain it (using the CFRetain function) or, in some cases, copy it. If you use a Copy or Create function, you are responsible for releasing the object (using the CFRelease function). For more details, see Memory Management Programming Guide for Core Foundation.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号