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

  • Home
  • SEARCH
  • 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 6219527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:47:57+00:00 2026-05-24T07:47:57+00:00

Using the analyzer in XCode 4, I’m getting warnings of potential memory leaks due

  • 0

Using the analyzer in XCode 4, I’m getting warnings of potential memory leaks due to setting a property like this:

self.newDog.dogName = self.dogNameTextField.text;

The specific warning is:

  1. Property returns an Objective-C object with a +1 retain count (owning reference).

  2. Object allocated on line 513 is not referenced later in this execution path and has a retain count of +1 (object leaked)

If I don’t set the property using self, the warning goes away… but I’m not sure if that won’t cause other issues since everything I’ve read basically says to always use self when setting/getting properties:

newDog.dogName = self.dogNameTextField.text;

Am I doing something else wrong here? Here’s some stripped down code from the view controller where the warnings occur:

@interface AddDogViewController : UITableViewController {
    Dog *newDog;
}

@property (nonatomic, retain) Dog *newDog;




@implementation AddDogViewController

@synthesize newDog;

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    // some other code

    self.newDog.dogName = self.dogNameTextField.text;

    // some other code
}


- (void)dealloc {
    [newDog release];
    [super dealloc];
}

@end
  • 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-24T07:47:58+00:00Added an answer on May 24, 2026 at 7:47 am

    According to the memory management rules, a method that begins with new returns a +1 retain count (just like alloc and copy). Your accessor newDog has such a name.

    You should rename your property to something that does not start with new. Note that you’re not actually leaking anything here. You’re just confusing the analyzer because you’re violating the naming rules.

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

Sidebar

Related Questions

I'm just investigating some memory leaks in my app, I'm using Xcode 4.0.2. I've
Having just upgraded to iOS 4.1 (Xcode 3.2.4) I am getting warnings when using
I am using latest Xcode, and trying to find memory leaks. When i use
I'm trying to solve memory leaks in my application. Using the Eclipse Memory Analyzer.
I am using the 'analyze' tool in xcode to check for potential leakages in
Using the build and analyze of XCode I saw i have a memory leak
I found that static analyzer means run with analyzer using xcode. Then what does
So, get this: Ever since I've started using XCode to handle my software development
I am developing an iPad app and found some memory leaks using Instruments and
This is the question: Im using Lucene.Net, and Im importing like ~255k documents with

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.