diff --git a/ChangeLog b/ChangeLog index 88eb73a8a..2036b55f7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2012-03-16 Wolfgang Sourdeau + * OpenChange/MAPIStoreSOGo.m (sogo_backend_init): check for + "SOGoDebugLeaks" in the user defaults and activate GSDebug + allocation utilities. + * OpenChange/NSData+MAPIStore.m (+dataWithChangeKeyGUID:andCnt:): new method replacing _dataFromChangeKeyGUID:andCnt: from MAPIStore{GCS,Mail}Folder. diff --git a/OpenChange/MAPIStoreSOGo.m b/OpenChange/MAPIStoreSOGo.m index 69df2ffc5..f2b6a807e 100644 --- a/OpenChange/MAPIStoreSOGo.m +++ b/OpenChange/MAPIStoreSOGo.m @@ -23,6 +23,7 @@ /* OpenChange SOGo storage backend */ #import +#import #import #import #import @@ -48,6 +49,7 @@ #include static Class MAPIStoreContextK = Nil; +static BOOL leakDebugging = NO; static enum mapistore_error sogo_backend_unexpected_error() @@ -57,6 +59,16 @@ sogo_backend_unexpected_error() return MAPISTORE_SUCCESS; } +static void +sogo_backend_atexit (void) +{ + NSAutoreleasePool *pool; + + pool = [NSAutoreleasePool new]; + NSLog (@"allocated classes:\n%s", GSDebugAllocationList (YES)); + [pool release]; +} + /** \details Initialize sogo mapistore backend @@ -89,6 +101,14 @@ sogo_backend_init (void) ud = [NSUserDefaults standardUserDefaults]; [ud registerDefaults: [ud persistentDomainForName: @"sogod"]]; + if (!leakDebugging && [ud boolForKey: @"SOGoDebugLeaks"]) + { + NSLog (@" leak debugging on"); + GSDebugAllocationActive (YES); + atexit (sogo_backend_atexit); + leakDebugging = YES; + } + registry = [SoProductRegistry sharedProductRegistry]; [registry scanForProductsInDirectory: SOGO_BUNDLES_DIR];