From a7b876c87a64030353d4e6f09ecb64761cd354f0 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Sat, 10 Oct 2009 18:30:30 +0000 Subject: [PATCH] Monotone-Parent: e68a1439ae451b39e7dc057e67708f2af5fcc040 Monotone-Revision: 1d41463c98c6e569d444ae5521059b400945db56 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2009-10-10T18:30:30 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 5 +++++ Main/SOGo.m | 24 +++++++++++------------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8cce1fce5..ce6918a78 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-10-10 Wolfgang Sourdeau + + * Main/SOGo.m (-init): released "rm" when no longer needed. + (-dispatchRequest:): simplified leak catching code. + 2009-10-08 Wolfgang Sourdeau * SoObjects/SOGo/LDAPSource.m (-_searchAttributes): we already diff --git a/Main/SOGo.m b/Main/SOGo.m index d61da0e75..70d7cb9be 100644 --- a/Main/SOGo.m +++ b/Main/SOGo.m @@ -147,6 +147,7 @@ static BOOL debugObjectAllocation = NO; /* setup resource manager */ rm = [[WEResourceManager alloc] init]; [self setResourceManager:rm]; + [rm release]; } return self; @@ -406,9 +407,9 @@ static BOOL debugObjectAllocation = NO; - (WOResponse *) dispatchRequest: (WORequest *) _request { static NSArray *runLoopModes = nil; + static BOOL debugOn = NO; WOResponse *resp; NSDate *startDate, *endDate; - NSAutoreleasePool *pool; if (debugRequests) { @@ -420,9 +421,15 @@ static BOOL debugObjectAllocation = NO; cache = [SOGoCache sharedCache]; if (debugLeaks) { - GSDebugAllocationActive (YES); - GSDebugAllocationList (NO); - pool = [NSAutoreleasePool new]; + if (debugOn) + { + NSLog (@"allocated classes:\n%s", GSDebugAllocationList (YES)); + } + else + { + debugOn = YES; + GSDebugAllocationActive (YES); + } } resp = [super dispatchRequest: _request]; @@ -435,15 +442,6 @@ static BOOL debugObjectAllocation = NO; [endDate timeIntervalSinceDate: startDate]]; } - if (debugLeaks) - { - [resp retain]; - [pool release]; - [resp autorelease]; - NSLog (@"allocated classes:\n%s", GSDebugAllocationList (YES)); - GSDebugAllocationActive (NO); - } - if (![self isTerminating]) { if (!runLoopModes)