天天看點

CFRelease 方法

CFRelease

釋放掉一個類的所占的記憶體

聲明

void CFRelease( CFTypeRef cf );

參數

cf  一個要釋放的 CFType 類,這個值一定不能為 NULL

說明

如果引用計數變為0,類的記憶體位址将會回收,類也将被銷毀。

如果你建立,複制,或者保留一個對象,在你不需要它的時候,就有責任将它釋放掉。

注意

如果 cf 為 NULL,将會導緻一個運作時錯誤,應用程式将會崩潰。

CFRelease

Releases a Core Foundation object.

Declaration

OBJECTIVE-C

void CFRelease ( CFTypeRef cf );

Parameters

cf A CFType object to release. This value must not be NULL.

Discussion

If the retain count of cf becomes zero the memory allocated to the object is deallocated and the object is destroyed. If you create, copy, or explicitly retain (see the CFRetain function) a Core Foundation object, you are responsible for releasing it when you no longer need it (see Memory Management Programming Guide for Core Foundation).

Special Considerations

If cf is NULL, this will cause a runtime error and your application will crash.

Import Statement

Availability

Available in iOS 2.0 and later.