saving a large nsstring file many times crashes the application
===

the following code crashes.Basically i am accessing a very large string(xml -contains image data) saved as a file...modifying it and saving it in a new name... when profiling i didnot see any leak with this code... but after repeating this process for 20-25 times... the app crashes on iphone 3gs with memory warning level three and it kills the whole apps running too... i cant find any place where this app is leaking to cause a memory warning ....any suggestions


    NSAutoreleasePool *pool=[[NSAutoreleasePool alloc] init];
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
     NSString *documents = [paths objectAtIndex:0];
     NSString *filename = [NSString stringWithFormat:@"%@.yyy",fileToDuplicate];
     NSString *initPath = [documents stringByAppendingPathComponent:filename];
     NSString *final = [NSString stringWithFormat:@"%@.yyy",[[alertView textFieldAtIndex:0] text]];
     NSString *finalPath = [documents stringByAppendingPathComponent:final];
     NSString *newName=[[[alertView textFieldAtIndex:0] text] copy];
     NSError *error;
     NSString *xml = [[NSString alloc] initWithContentsOfFile:initPath encoding:NSASCIIStringEncoding error:&error] ;
     NSString *xml_1=[xml stringByReplacingOccurrencesOfString:[NSString stringWithFormat:@"<file_name><name>%@.yyy</name></file_name>",fileToDuplicate] withString:[NSString stringWithFormat:@"<file_name><name>%@.yyy</name></file_name>",newName]];
    NSString *xml_2=[xml_1 stringByReplacingOccurrencesOfString:[NSString stringWithFormat:@"<property_name>%@</property_name>",fileToDuplicate] withString:[NSString stringWithFormat:@"<property_name>%@</property_name>",newName]];
    [xml_2 writeToFile:finalPath atomically:YES encoding:NSASCIIStringEncoding error:&error];
     xml=nil;
     [xml release];
     xml_1=nil;
     xml_2=nil;
     [self.mTableView reloadData];
     fileToDuplicate=@"";
     [newName release];
     [pool drain];
     return ;