ARC-数据类型需要释放的情况

// Foundation :  OC
// Core Foundation : C语言
// Foundation和Core Foundation框架的数据类型可以互相转换的

//NSString *str = @"123"; // Foundation
//CFStringRef str2 = (__bridge CFStringRef)str; // Core Foundation
//NSString *str3 = (__bridge NSString *)str2;
//    CFArrayRef ---- NSArray
//    CFDictionaryRef ---- NSDictionary
//    CFNumberRef ---- NSNumber

// Core Foundation中手动创建的数据类型,都需要手动释放
//    CFArrayRef array = CFArrayCreate(NULL, NULL, 10, NULL);
//    CFRelease(array);
//
//
//    CGPathRef path = CGPathCreateMutable();
//    CGPathRetain(path);
//
//    CGPathRelease(path);
//    CGPathRelease(path);
/**
 凡是函数名中带有create\copy\new\retain等字眼, 都应该在不需要使用这个数据的时候进行release
 GCD的数据类型在ARC环境下不需要再做release
 CF(Core Foundation)的数据类型在ARC\MRC环境下都需要再做release

posted @ 2016-04-07 21:02  nxz_diy  阅读(359)  评论(0编辑  收藏  举报