cocoa - ARC: Analyzer warnings with Objective-C code using core foundation -
using analyzer on objective-c | cocoa / core foundation code, got few error can't fix because don't understand them.
error #1: in objective-c class header, declare property.
@property(readwrite) cfmutablesetref gclients;
in body, following error:
question: why leak ? store in property , dispose of later. thought arc knew how deal cf "objects".
error #2: later on, have error when releasing object:
question: how can take 2 analyzer warnings account in order create code works (self.gclients lives between calls clientinitialize , destroyallclients) not flagged?
arc doesn't manage cf objects without manual intervention. there work need first.
see http://www.idryman.org/blog/2012/11/22/arc-best-practices-and-pitfalls/ @ "arc , toll-free bridging". there special casting tricks (__bridge_transfer)
.
Comments
Post a Comment