iPhone, confusing memory leak.

Posted by fuzzygoat on Stack Overflow See other posts from Stack Overflow or by fuzzygoat
Published on 2010-04-09T23:41:07Z Indexed on 2010/04/09 23:43 UTC
Read the original article Hit count: 276

Filed under:
|
|

Can anyone tell me what I am doing wrong with the bottom section of code. I was sure it was fine but "Leaks" says it is leaking which quickly changing it o the top version stops, just not sure as to why the bottom variation fails?

// Leaks says this is OK
if([elementName isEqualToString:@"rotData-requested"]) {
    int myInt = [[self elementValue] intValue];
    NSNumber *valueAsNumber = [NSNumber numberWithInt:myInt];
    [self setRotData:valueAsNumber];
    return;
}

.

// Leaks says this LEAKS    
if([elementName isEqualToString:@"rotData-requested"]) {
    NSNumber *valueAsNumber = [NSNumber numberWithInt:[[self elementValue] intValue]];
    [self setRotData:valueAsNumber];
    return;
}

any help would be appreciated.

gary

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c