I am hitting the memo开发者_StackOverflow中文版ry leak warning message as seen in the screenshot below.

I need some advise on how I can resolve this memory leak. Can I just do a [self release] at the end of the method?
You are not assigning the object returned to _sharedUserStockInfo so you are losing reference and leaking. Over that _sharedUserStockInfo will remain nil and method will return nil too.
+(UserStockInfo*)shareduserStockInfo{
@synchronized([UserStockInfo class])
{
if(! _sharedUserStockInfo)
_sharedUserStockInfo= [[self alloc]init];
return _sharedUserStockInfo;
}
return nil;
}
加载中,请稍侯......
精彩评论