wrong memory leak warning ?

Hello,

I'm getting a warning about an object that might not have been released in this code:

-(void) test {
    UIView * myView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 10)];
    UIView * myViewReference = myView;
    [myViewReference release];
}


Is this a bug or should I read again the fundamentals of Objective C ? :)

regards,
Tex

0
3 comments
Avatar
Permanently deleted user

Well technically I guess it's a bug, but I would say more a limitation; I imagine the logic of the leak detection algorithm is quite primitive in terms of it following references through the code.
This one is quite trivial, but things could get a lot more complex very easily. So I guess it errs on the side of caution and simplicity.
Of course the easy way to not see the limitation is to replace [myViewReference release]; with [myView release];

N.

0
Avatar
Permanently deleted user

nedski wrote:

Well technically I guess it's a bug, but I would say more a limitation; I imagine the logic of the leak detection algorithm is quite primitive in terms of it following references through the code.
This one is quite trivial, but things could get a lot more complex very easily. So I guess it errs on the side of caution and simplicity.
Of course the easy way to not see the limitation is to replace [myViewReference release]; with [myView release];

N.


ok, I just wanted to be sure.

thanks

0

Please sign in to leave a comment.