In my iPad App,
I am using AQGridView.
This app is all about matching the cards to its categories.
In that I am deleting the cells.
If I am just opening the app for a few minutes it will not crashed.
But If I am playing the app for 3 to 4 minutes and deleting many cells it is getting crashes in the method.
Some memory leaks that I could not solve...
I have one array called imageMarray
I am doing shuffling on it.
In View Did Load.
imageMArray=[NSMutableArray initWithArray:CategoryImages];
imageMArray=[[self shuffleOnlyArray:imageMArray] retain];
In shuffleOnlyArray Method
-(NSMutableArray*)shuffleOnlyArray:(NSMutableArray*)sourceArray
{
NSMutableArray *destArray1 = [[[NSMutableArray alloc] initWithCapacity: [sourceArray count]] autorelease];
srandom( time(NULL));
while ([sourceArray count] != 0)
{
NSUInteger index = (NSUInteger)(random() % [sourceArray count]);
id item = [sourceArray objectAtIndex: index];
[destArray1 addObject: item];
[sourceArray removeObjectAtIndex:index];
}
[sourceArray release];
sourceArray=nil;
return destArray1;
}
And In shuffle Method I am writing
imageMArray=[[self shuffleOnlyArray:imageMArray] retain];
Where should I write release. So it does remove memory leak.