- 389 名前:デフォルトの名無しさん mailto:sage [2011/12/06(火) 17:53:40.59 ]
- 自力リファレンスカウンタ方式なら通常運用で解放できるんじゃね?
static long refCount = 0; @implementation Hoge static Hoge *sharedInstance = nil; - (id)allocWithZone:(NSZone *)zone { refCount++; // 以下テンプレ通り } - (id)retain { refCount++; return self; } - (id)autorelease { [[[Foo alloc] initWithObj:self] autorelease]; return self; } - (oneway void)release { if(--refCount == 0) [self dealloc]: } @end @implementation Foo - (id)initWithObj:(id)inObj { obj = [inObj retain]; } -(void)dealloc { [obj release]; [super dealloc]; } @end とか
|

|