From 5ce91070b5ff229de819d5e4b68fcae72297f634 Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Thu, 12 Apr 2012 23:48:20 +0000 Subject: - Manually handle some SPFileHandle memory management to significantly improve memory usage during large exports, particularly improving memory which appeared to never be reclaimed - Fix some minor memory leaks throughout the application --- Source/SPFileHandle.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Source/SPFileHandle.m') diff --git a/Source/SPFileHandle.m b/Source/SPFileHandle.m index 3701fc8c..94c26211 100644 --- a/Source/SPFileHandle.m +++ b/Source/SPFileHandle.m @@ -414,7 +414,7 @@ } // Copy the data into a local buffer - NSData *dataToBeWritten = [NSData dataWithData:buffer]; + NSData *dataToBeWritten = [buffer copy]; [buffer setLength:0]; bufferDataLength = 0; pthread_mutex_unlock(&bufferLock); @@ -453,6 +453,8 @@ allDataWritten = YES; } pthread_mutex_unlock(&bufferLock); + + [dataToBeWritten release]; } [writePool drain]; -- cgit v1.2.3