I have a bunch of lines like this on my app
UIColor *myColor = [UIColor colorWithRed:corR green:corG blue:corB alpha:1.0];
Instruments are saying these lines are leaking. As this is not formally, as far as I see, an alloc operation (isn't it?) I don't saw the need to release the object, but as instruments are complaining, I added several lines as
[myColor release]
after using the variable, to please the beast.
Will I have problems doing this, like crashes or something?
Apparently doing this is solving the problem, but I am not comfortable to release an object that was not allocated.
What do you think?
thanks.
E D I T
I suppose this is a xcode problem or a framework leak.
To prove that I replace the lines with
UIColor *myColor = [[UIColor alloc] initWithRed:corR green:corG blue:corB alpha:1.0];
and then the object could be safely released...
doing that, solved the problem.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…