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 8449145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:37:30+00:00 2026-06-10T10:37:30+00:00

I am stuck trying to analyze why Xcode analyzer (v4.2) complaints that my objective-c

  • 0

I am stuck trying to analyze why Xcode analyzer (v4.2) complaints that my objective-c code leaks memory. I am creating a NSOperation that 1) recursively creates a directory if it does not exists, 2) copies a file from one directory to another into that directory.

The NSOperation is initialized with:

- (id)initWithFullPathSource:(NSString *) mysource andFullPathCopy:(NSString *) mycopy     andNewDirectory:(NSString *) mydir withMode:(NSString *) mymode withLR:(NSString *) LR
{

     self = [super init];
     if (self) {

        [self setFullPathSource:mysource];
        [self setFullPathCopy:mycopy];
        [self setNewDirectory:mydir];
        [self setMode:mymode];
        [self setMyLR:LR];
    }

    return self;
}

Attached is a screenshot of how Xcode analyzer sees my code. Could anyone please help me understand why I am leaking memory in this case? I am releasing ‘createComponents’ and ‘removeComponents’ at the end of the main routine so I thought I was in the clear.

Hope someone can shed some light on my problem. Thanks! Cheers, Trond

enter image description here

  • 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-06-10T10:37:32+00:00Added an answer on June 10, 2026 at 10:37 am

    Be aware that under the objective c naming rules, a method that starts with the word new or copy is assumed to return an object that is owned by the caller. If the call to [self newDirectory] returns an autoreleased object, then try renaming it so it doesn’t begin with new.

    There is a great answer explaining more here: Semantic Issue: Property's synthesized getter follows Cocoa naming convention for returning 'owned' objects

    A suggestion would be to either change the name of the getter on the property like so:

    @property (strong, nonatomic, getter=theNewDirectory) NSString *newDirectory;
    

    Or call it something like : directoryToBeCreated

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

Sidebar

Related Questions

Sometimes I still get stuck trying to translate procedural code into functional code. Is
I'm currently stuck trying to wrap a section of a native C++ API that
I'm stuck trying to define an XSD containing a field that can have only
We are trying to analyze a w3wp memory dump using windbg and we found
I'm stuck trying to make a regex in PHP that catches the link and
I'm stuck trying to loop through this array of GPS coordinates that puts pins
I got really stuck trying to deallocate memory using delete without it being in
I'm a bit stuck trying to get my code to output correctly, see below.
I'm trying to piece together an algorithm (preferably in ruby) that will analyze a
Hello I'm stuck trying to add a function to my Windows forms program that

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.