Skip to content

Commit

Permalink
moved auto release pools up to notice creation level
Browse files Browse the repository at this point in the history
  • Loading branch information
calebd committed Jun 5, 2011
1 parent ced8c9e commit b0252b5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
7 changes: 1 addition & 6 deletions hoptoadnotifier/HTNotice.m
Expand Up @@ -38,10 +38,9 @@ + (HTNotice *)noticeWithContentsOfFile:(NSString *)path {
return nil;
}

// setup
HTNotice *notice = [[HTNotice alloc] init];
NSMutableDictionary *info = [NSMutableDictionary dictionaryWithCapacity:3];

// stuff
NSData *data = [NSData dataWithContentsOfFile:path];
NSUInteger location = 0;
NSUInteger length = 0;
Expand Down Expand Up @@ -232,7 +231,6 @@ - (NSString *)hoptoadXMLString {
[error addChild:[DDXMLElement elementWithName:@"message" stringValue:message]];
DDXMLElement *backtrace = [[DDXMLElement alloc] initWithName:@"backtrace"];
for (NSArray *line in self.callStack) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
DDXMLElement *element = [DDXMLElement elementWithName:@"line"];
[element addAttribute:
[DDXMLElement
Expand All @@ -247,7 +245,6 @@ - (NSString *)hoptoadXMLString {
attributeWithName:@"method"
stringValue:[line objectAtIndex:2]]];
[backtrace addChild:element];
[pool release];
}
[error addChild:backtrace];
[notice addChild:error];
Expand All @@ -262,14 +259,12 @@ - (NSString *)hoptoadXMLString {
DDXMLElement *cgi = [[DDXMLElement alloc] initWithName:@"cgi-data"];
for (id key in [self.environmentInfo allKeys]) {
id value = [self.environmentInfo objectForKey:key];
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
DDXMLElement *element = [DDXMLElement elementWithName:@"var" stringValue:[value description]];
[element addAttribute:
[DDXMLElement
attributeWithName:@"key"
stringValue:[key description]]];
[cgi addChild:element];
[pool release];
}
[request addChild:cgi];
[notice addChild:request];
Expand Down
12 changes: 6 additions & 6 deletions hoptoadnotifier/HTNotifier.m
Expand Up @@ -96,9 +96,6 @@ - (id)initWithAPIKey:(NSString *)key environmentName:(NSString *)name {
}
- (void)postNoticesWithPaths:(NSArray *)paths {

// pool
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

// notify delegate
if ([paths count] && [self.delegate respondsToSelector:@selector(notifierWillPostNotices)]) {
[self.delegate
Expand Down Expand Up @@ -152,13 +149,13 @@ - (void)postNoticesWithPaths:(NSArray *)paths {
withObject:nil
waitUntilDone:YES];
}

// pool
[pool drain];

}
- (void)postNoticeWithPath:(NSString *)path {

// pool
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

// get notice payload
HTNotice *notice = [HTNotice noticeWithContentsOfFile:path];
if (notice == nil) {
Expand Down Expand Up @@ -209,6 +206,9 @@ - (void)postNoticeWithPath:(NSString *)path {
[responseString release];
}

// pool
[pool drain];

}
- (BOOL)isHoptoadReachable {
SCNetworkReachabilityFlags flags;
Expand Down

0 comments on commit b0252b5

Please sign in to comment.