开发者

NSXMLParserDelegate memory issues

I'm running my app through Instruments, and every time the following setup causes a memory leak (apparently). I can't see an issue with this.

WeatherParser.h:

...
{
    NSMutableDictionary *results;
}

@property (nonatomic, retain) NSMutableDictionary *results;

WeatherParser.m

- (void)parserDidStartDocument:(NSXMLParser *)parser
{    
    self.开发者_开发技巧results = [[NSMutableDictionary alloc] init];
}

...add values to results

- (void)dealloc
{
    self.results = nil;
    [self.results release];

    [super dealloc];
}

Would greatly appreciate any observations.


Swap these around to read:

[self.results release]; 
self.results = nil;

you were calling the release on the nil object not on the results array.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜