release NSMutable array in obj-c
<p><strong>where to dealloc/ release  my NS-mutable array a1</strong> ??</p>

<p>see this</p>

<pre><code>- (void)viewDidLoad {

[NSThread detachNewThreadSelector:@selector(loadImage) toTarget:self withObject:nil];


}

- (void) loadImage
{

    NSLog(@" THREAD METHOD");





    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];  


    NSUserDefaults *imgg = [NSUserDefaults standardUserDefaults];
    myimg= [imgg stringForKey:@"keyToimg"];
    NSLog(@"RES image sssssssss  is = %@",myimg);

    a1 = [[NSMutableArray alloc] init];
    [a1 addObjectsFromArray:[myimg componentsSeparatedByString:@"\n\t"]];



    //[a1 removeAllObjects];
    //// 
    //[myimg release];
    [pool release];


}
</code></pre>

<p><strong>and in table cell  of secition 3 i am displaying image</strong></p>

<pre><code>switch(indexPath.section)
{

                                    NSString *urlE=[a1 objectAtIndex:1];
            NSLog(@"url is %@",urlE);

            NSData *backgroundData = [NSData dataWithContentsOfURL:[NSURL URLWithString:urlE]]; 


            image = [UIImage imageWithData:backgroundData];
            myImageView= [[UIImageView alloc] initWithImage:image];
            [myImageView setUserInteractionEnabled:YES]; 

            CGRect rect=CGRectMake(20 ,10, 270, 180);

            myImageView.frame = rect;
            myImageView.tag = i;    
                    [cell.contentView addSubview:myImageView];

}
</code></pre>

<p><strong>and based on tap images are changing</strong> </p>

<h1>pragma mark working image tap</h1>

<pre><code>- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    NSLog(@" life count %d",[myimg retainCount]);

    NSLog(@" life  array count %d",[a1 retainCount]);     

    //NSLog(@" GITSHffffffffffffffffffffffffffffffC");
    NSUInteger sections = [indexPath section]; 
    //NSLog(@"row is %d",sections);
    if (sections  == 3)
    { //Its either 1 or 0 I don't remember, it's been a while since I did some tableview  
        if(tap&lt;[a1 count]-1) {
            NSLog(@" life  array count %d",[a1 retainCount]);     
            tap++;

            NSString *sa=[a1 objectAtIndex:tap];
        //////////////////////
            image= [[UIImage alloc] initWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:[NSString stringWithFormat: sa,[a1 objectAtIndex:tap ]]]]];


            NSData *imageData = [NSData dataWithData:UIImageJPEGRepresentation(image, 1.0)]; 


            myImageView.image = image;
            //[myimg release];
            //[a1 release];

        }
        else {
            tap=1;
            //[myimg release];
            //[a1 release];
        }



        }



        //[a1 release];


}   
</code></pre>

<p>so where should i release <strong>my a1 and myimg</strong></p>
