From ec868276aad6ced4be5c42ea2a9c65b62b25c269 Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Fri, 25 Dec 2009 22:52:52 +0000 Subject: [PATCH] See ChangeLog Monotone-Parent: 5475eac0e45624fa60269bb388e23e6e2dc89bd8 Monotone-Revision: 53a3680b094640a96987cce96326daad38a619e0 Monotone-Author: ludovic@Sophos.ca Monotone-Date: 2009-12-25T22:52:52 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 7 +++++++ Tools/SOGoToolBackup.m | 11 +++++++++++ 2 files changed, 18 insertions(+) diff --git a/ChangeLog b/ChangeLog index 7fee20f90..42e07ba88 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-12-25 Ludovic Marcotte + + * Tools/SOGoToolBackup.m (-fetchUserIDs:): + We now use a local autorelease pool and flush + it after every 100 requests to the LDAP (or + other source type) server. + 2009-12-23 Ludovic Marcotte * UI/Scheduler/UIxCalView.m diff --git a/Tools/SOGoToolBackup.m b/Tools/SOGoToolBackup.m index c58e7dffd..907951d56 100644 --- a/Tools/SOGoToolBackup.m +++ b/Tools/SOGoToolBackup.m @@ -21,6 +21,7 @@ */ #import +#import #import #import #import @@ -118,6 +119,7 @@ - (BOOL) fetchUserIDs: (NSArray *) users { + NSAutoreleasePool *pool; SOGoUserManager *lm; NSDictionary *infos; NSString *user; @@ -125,6 +127,8 @@ int count, max; lm = [SOGoUserManager sharedUserManager]; + pool = [[NSAutoreleasePool alloc] init]; + max = [users count]; user = [users objectAtIndex: 0]; if (max == 1 && [user isEqualToString: @"ALL"]) @@ -134,6 +138,12 @@ allUsers = [NSMutableArray array]; for (count = 0; count < max; count++) { + if (count > 0 && count%100 == 0) + { + DESTROY(pool); + pool = [[NSAutoreleasePool alloc] init]; + } + user = [users objectAtIndex: count]; infos = [lm contactInfosForUserWithUIDorEmail: user]; if (infos) @@ -144,6 +154,7 @@ } ASSIGN (userIDs, [allUsers objectsForKey: @"c_uid" notFoundMarker: nil]); + DESTROY(pool); return ([userIDs count] > 0); }