From 255bcbe92fa6b4610edf5f4d05c97b74537ecb6e Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Mon, 22 Dec 2014 19:59:33 -0500 Subject: [PATCH] Fixed memory leaks in SOGoSyncCacheObject and correctly kill the cache upon each EAS iteration --- ActiveSync/SOGoSyncCacheObject.m | 2 +- SoObjects/Mailer/SOGoMailBaseObject.m | 4 ---- SoObjects/SOGo/NSObject+Utilities.m | 3 +++ UI/MainUI/SOGoMicrosoftActiveSyncActions.m | 8 +++++++- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/ActiveSync/SOGoSyncCacheObject.m b/ActiveSync/SOGoSyncCacheObject.m index ab973348d..63c545b34 100644 --- a/ActiveSync/SOGoSyncCacheObject.m +++ b/ActiveSync/SOGoSyncCacheObject.m @@ -55,7 +55,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. [o setUID: theUID]; [o setSequence: theSequence]; - return o; + return [o autorelease]; } - (void) dealloc diff --git a/SoObjects/Mailer/SOGoMailBaseObject.m b/SoObjects/Mailer/SOGoMailBaseObject.m index 73967efe0..863491e2e 100644 --- a/SoObjects/Mailer/SOGoMailBaseObject.m +++ b/SoObjects/Mailer/SOGoMailBaseObject.m @@ -43,10 +43,6 @@ @implementation SOGoMailBaseObject -#if 0 -static BOOL debugOn = YES; -#endif - - (id) initWithImap4URL: (NSURL *) _url inContainer: (id) _container { diff --git a/SoObjects/SOGo/NSObject+Utilities.m b/SoObjects/SOGo/NSObject+Utilities.m index b85a7e528..3dca1f0f5 100644 --- a/SoObjects/SOGo/NSObject+Utilities.m +++ b/SoObjects/SOGo/NSObject+Utilities.m @@ -123,6 +123,9 @@ return label; } +// +// Set SOGoDebugLeaks = YES in your defaults to enable. +// + (void) memoryStatistics { Class *classList = GSDebugAllocationClassList (); diff --git a/UI/MainUI/SOGoMicrosoftActiveSyncActions.m b/UI/MainUI/SOGoMicrosoftActiveSyncActions.m index a00344fba..c487d5cce 100644 --- a/UI/MainUI/SOGoMicrosoftActiveSyncActions.m +++ b/UI/MainUI/SOGoMicrosoftActiveSyncActions.m @@ -21,6 +21,8 @@ #import +#import +#import #import #import @@ -54,13 +56,17 @@ ex = [dispatcher dispatchRequest: request inResponse: response context: context]; + //[[self class] memoryStatistics]; + if (ex) { return [NSException exceptionWithHTTPStatus: 500]; } RELEASE(dispatcher); - + + [[SOGoCache sharedCache] killCache]; + return response; }