Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6903219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:53:53+00:00 2026-05-27T07:53:53+00:00

I am using the analyse menu option from within Xcode 4.2 and I have

  • 0

I am using the “analyse” menu option from within Xcode 4.2 and I have three “potential leaks”. What is a “potential leak”??

When I build and run the app, everything works fine. When I use the ‘leaks’ tool, none of these three parts of code are shown to leak. So can these ‘potential leaks’ just be ignored?

The three sections of code that contain ‘potential leaks’ are (note, these are not sequential blocks of code, but are on different files)…

First…

- (void)DoDomainCheck {
AppDelegate *dataCentre = (AppDelegate *) [[UIApplication sharedApplication] delegate];
NSString *queryStringFull = [queryStringFirst stringByAppendingString:dataCentre.DomainCheckData];
labeltocheck.text = dataCentre.DomainCheckData;

responseData = [NSMutableData new];
NSURL *url = [NSURL URLWithString:@"http://www.myurl.com/whois.php"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0];
NSData *requestData = [queryStringFull dataUsingEncoding:NSUTF8StringEncoding];

[request setHTTPMethod:@"POST"];
[request setValue:@"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" forHTTPHeaderField:@"Accept"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
[request setValue:[NSString stringWithFormat:@"%d", [requestData length]] forHTTPHeaderField:@"Content-Length"];
[request setHTTPBody: requestData];
[[NSURLConnection alloc] initWithRequest:request delegate:self];
}

Second…

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}

int storyIndex = [indexPath indexAtPosition: [indexPath length] - 1];
cell.textLabel.text = [[stories objectAtIndex: storyIndex] objectForKey: @"date"];
cell.detailTextLabel.text = [[stories objectAtIndex: storyIndex] objectForKey: @"title"];

[cell.textLabel setLineBreakMode:UILineBreakModeWordWrap];
[cell.textLabel setNumberOfLines:0];
[cell.textLabel sizeToFit];

cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;
}

Third…

- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName {
if ([elementName isEqualToString:@"item"]) {
    [item setObject:currentImage forKey:@"media"];
    [item setObject:currentTitle forKey:@"title"];
    [item setObject:currentLink forKey:@"link"];
    [item setObject:currentSummary forKey:@"summary"];
    [item setObject:currentDate forKey:@"date"];
    [stories addObject:[item copy]];
}
}

Can anyone see any obvious issues with these sections of code, or can I just ignore these ‘potential’ leaks?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T07:53:54+00:00Added an answer on May 27, 2026 at 7:53 am

    in Analyzer click on the arrow indicators to see the path through the code that produces the potential leak.

    Part 1:
    for autoreleased responseData use:

    responseData = [NSMutableData data];
    
    [[NSURLConnection alloc] initWithRequest:request delegate:self];
    

    an NSURLConnection is allocated

    Part 2:
    See the answer by @Bill Bransky

    Part 3:

    [stories addObject:[item copy]];

    The copy is not necessary, it increases the reference count and addObject also increases the reference count. When the stories object is releases a release will be sent to each of it’s items but there will still be an extra reference count from the copy.

    About the copy, when writing code always know exactly why each statement and statement part is written. If in doubt research. Adding code without knowing exactly will create that “works by coincidence”, is fragile and will probably cause problems later.

    It would really help you to study Apple’s memory management documents. Also strongly consider ARC.

    In answer to your question, leaks don’t cause crashes but do use memory and that can be a problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just upgraded to Xcode 3.2 and am using the Build and Analyze feature
When am using build and analyse method the following error occurs:- /Users/ghost/demo/libs/cocos2d/CCSprite.m:476:2 Assigned value
I have been using three classes. Two classes extends the third class db. But
We're using SQL Server 2000 Query Analyser, and one issue we have is that
I am attempting to analyze an iPhone application using the Leaks application and everything
Using online interfaces to a version control system is a nice way to have
I have a client server application writter in C# .NET using Sockets. I often
A query (see below) that extracts climate data from weather stations within a given
I've been using the Service Trace Viewer to analyse the WCF service calls that
I'm trying to analyse some code here that's been designed using an MVP Approach.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.