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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:08:53+00:00 2026-05-13T20:08:53+00:00

In the book I’m studying from for iPhone dev, they utilize IBOutlet instances using

  • 0

In the book I’m studying from for iPhone dev, they utilize IBOutlet instances using the Interface Builder. An example would be a UIButton. So they add a thing in the struct like this:

 IBOutlet UIButton *whateverButton;

Then they add a @property for each of these in the .h, and a @synthesize in the .m.

Then they include a release in the dealloc of the .m. Two questions:

  1. Is the release necessary? Aren’t all properties already handled automatically?
  2. How can I check the ref count to see what’s happening, for debug purposes…?
  • 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-13T20:08:54+00:00Added an answer on May 13, 2026 at 8:08 pm

    Is the release necessary? Aren’t all
    properties already handled
    automatically?

    If the property is retained, the release is necessary. When you declare a @property and @synthesize it, all you get is the accessors, there is no special automatic behaviour in dealloc.

    Also, there is nothing magical about IBOutlet – it’s just a marker for Interface Builder to see which properties you would like to appear in IB. It’s simply an empty macro, Cmd-click the IBOutlet keyword to see its definition:

    #ifndef IBOutlet
    #define IBOutlet
    #endif
    

    Same thing goes for IBAction which expands to void.

    How can I check the ref count to see
    what’s happening, for debug
    purposes…?

    When I need to debug memory management, I usually simply set up a breakpoint in the dealloc method or log a string there. It is also helpful to log the retainCount of an object around the calls that might do something fishy with it.


    It might also help to see how the @synthesize directive creates the accessors. When you declare a retained @property and ask the compiler to @synthesize them, you get something like this:

    @property(retain) NSString *foo;
    @synthesize foo;
    
    - (void) foo {
        return foo;
    }
    
    - (void) setFoo: (NSString*) newFoo {
        // Try to think what would happen if this condition wasn’t
        // here and somebody called [anObject setFoo:anObject.foo].
        if (newFoo == foo)
            return;
        [foo release];
        foo = [newFoo retain];
    }
    

    This isn’t exactly the thing, but it’s close enough. Now it should be more clear why you should release in dealloc.

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

Sidebar

Related Questions

Almost every Java book I read talks about using the interface as a way
I was recommeded a book called: Accelerated C++ Practical Programming by Example by Andrew
David Flanagan's excellent book on JavaScript has an example that shows how to perform
The book that I purchased to help with my SSIS understanding seems to have
Anyone know a good book or post about how to start in EF? I
I've read the book Programming Collective Intelligence and found it fascinating. I'd recently heard
I was reading a book on programming skills wherein the author asks the interviewee,
I'm reading the book The Software Architect's Profession by Marc and Laura Sewell (
In the (otherwise) excellent book C++ Coding Standards , Item 44, titled Prefer writing
An old Direct3D book says ...you can achieve an acceptable frame rate with hardware

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.