I have one function like this
-(NSMutableArray *)getData
{
NSMutableArray *tempArr=[NSMutableArray alloc]init];
// perform some operation on tempArr
return tempArr;
}
In above example i created new object for nsmutablearray and need to return its refernce.
Now everything is working fine however when i run it with instruments (leaks) it shows 100 % memory leak at “NSMutableArray *tempArr=[NSMutableArray alloc]init];” this line .
what can be solution for this ,please do write to this thread
Thnx in advce
You will have to release it on return, like so