From f36df95c5c983e255f9c4ab79b76c3e4a132a974 Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Wed, 26 May 2010 15:05:48 +0000 Subject: Data export fixes: - Fix the same potential autorelease pool memory leak found in the CSV exporter in the XML exporter. - When performing an XML export to a single file don't write the header twice. - Remember to append the .xml extension when performing an XML export to a single file. --- Source/SPXMLExporter.m | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'Source/SPXMLExporter.m') diff --git a/Source/SPXMLExporter.m b/Source/SPXMLExporter.m index 94cfec05..de43560e 100644 --- a/Source/SPXMLExporter.m +++ b/Source/SPXMLExporter.m @@ -60,7 +60,6 @@ { @try { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - NSAutoreleasePool *xmlExportPool = [[NSAutoreleasePool alloc] init]; NSArray *xmlRow = nil; NSString *dataConversionString = nil; @@ -121,7 +120,7 @@ if ([self xmlDataArray]) currentRowIndex++; // Drop into the processing loop - xmlExportPool = [[NSAutoreleasePool alloc] init]; + NSAutoreleasePool *xmlExportPool = [[NSAutoreleasePool alloc] init]; currentPoolDataLength = 0; @@ -217,14 +216,14 @@ // Inform the delegate that the export's progress has been updated [delegate performSelectorOnMainThread:@selector(xmlExportProcessProgressUpdated:) withObject:self waitUntilDone:NO]; - // If an array was supplied and we've processed all rows, break - if ([self xmlDataArray] && totalRows == currentRowIndex) break; - // Drain the autorelease pool as required to keep memory usage low if (currentPoolDataLength > 250000) { [xmlExportPool release]; xmlExportPool = [[NSAutoreleasePool alloc] init]; } + + // If an array was supplied and we've processed all rows, break + if ([self xmlDataArray] && totalRows == currentRowIndex) break; } // Write the closing tag for the table @@ -239,6 +238,7 @@ // Inform the delegate that the export process is complete [delegate performSelectorOnMainThread:@selector(xmlExportProcessComplete:) withObject:self waitUntilDone:NO]; + [xmlExportPool release]; [pool release]; } @catch (NSException *e) { } -- cgit v1.2.3