Memory Management,Adding objects to array
<p>Hi friends I am using this code</p>

<pre><code>-(void)searchItem:(NSMutableArray*)items
{

    if ([[[items objectAtIndex:1]objectForKey:@"Success"]isEqualToString:@"True"]) {
    NSMutableArray *searcharr=[[NSMutableArray alloc]init];
            for (int i=2; i&lt;[items count]; i++) 
            {
                NSAutoreleasePool *pool=[[NSAutoreleasePool alloc]init];
                [searcharr addObject:[items objectAtIndex:i]];
                NSLog(@"data fetch array is====&gt; /n%@",searcharr);
                [pool release];
            }

            searchItemsArray=[[NSMutableArray alloc]initWithArray:searcharr];
            [searcharr release];
            searcharr=nil;
}
</code></pre>

<p>I have released searchItemsArray in dealloc method.The items array i am getting from a webservice.It contains images and other data.I was using the for loop without NSAutoreleasePool,But when i used the instrument with simulator,i was getting the leak here.I just want to know that the code which i have given here with pool is correct or not.My app was also crashing as i was feeding this data and images in tableview cell.So please help me out.
And one more thing should i always use NSAutorelease pool,while looping ......Thanks</p>
