如何修复apple80211 GetInfo Copy()内存泄漏?

时间:2015-03-26 20:45:29

标签: ios objective-c iphone memory-leaks network-programming

当我反复调用apple80211GetInfoCopy()时,为了跟踪RSSI,内存泄漏。

CFDictionaryRef info = NULL;
apple80211GetInfoCopy( airportHandle, &info );         // read WIFI info including RSSI from iOS

2 个答案:

答案 0 :(得分:0)

我解决了它:

CFDictionaryRef info = NULL;
apple80211GetInfoCopy( airportHandle, &info ); // read WIFI info including RSSI from iOS
[info release];

答案 1 :(得分:0)

由于函数apple80211GetInfoCopy()的名称包含单词" copy",您拥有它返回的对象,并且当您不再需要它时,您有责任释放它。您可以致电CFRelease(info)

(如果出现这种情况,请查看Apple Memory Management Policy。)