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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:49:39+00:00 2026-05-28T16:49:39+00:00

In an implementation of dealloc, you should not invoke the superclass’s implementation. You override

  • 0

In an implementation of dealloc, you should not invoke the
superclass’s implementation. You override this method to dispose of
resources other than the object’s instance variables, for example:

  • (void)dealloc
    {
    free(myBigBlockOfMemory);
    }

Above says we should not invoke the superclass’s implementation. But below it says we should “incorporate superclass versions of dealloc through a message to super.” So there seems to be some conflict between the two paragraphs. It must be due to something that I’ve missed. Hope somebody can explain this …

If you are using manual reference counting, subclasses must implement
their own versions of dealloc to allow the release of any additional
memory consumed by the object—such as dynamically allocated storage
for data or object instance variables owned by the deallocated object.
After performing the class-specific deallocation, the subclass method
should incorporate superclass versions of dealloc through a message to
super:

  • (void)dealloc {
    [companion release];
    free(myBigBlockOfMemory);
    [super dealloc]; }

http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/nsobject_Class/Reference/Reference.html

  • 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-28T16:49:40+00:00Added an answer on May 28, 2026 at 4:49 pm

    Your first quote is for when automatic reference counting (ARC) is enabled, and your second quote is for when ARC is not enabled. ARC is a new feature provided in SDK 5.0 that eliminates much of the manual memory management that needed to be done by the programmer.

    See Transitioning to ARC Release Notes, in particular these statements:

    You may implement a dealloc method if you need to manage resources
    other than releasing instance variables. You do not have to (indeed
    you cannot) release instance variables…

    Custom dealloc methods in ARC do not require a call to [super dealloc]
    (it actually results in a compiler error). The chaining to super is
    automated and enforced by the compiler.

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

Sidebar

Related Questions

Possible Duplicate: Why is object not dealloc'ed when using ARC + NSZombieEnabled I've got
I am curious if there is a good reason I should / should not
I've read a few posts on this, but there's still one thing that's not
This code is pretty simple, is it correct? I don't know if I should
I've seen that you should assign a property this way: - (void)viewDidLoad { NSDateFormatter
I've been wandering how I can release my retained property in my dealloc method
This is something I should have cleared up long ago, but I just need
I have a method call in a base class that looks like this: #import
Basically I have this scenario going on: //in interface header @property(nonatomic,retain)OtherClass *otherClass; //implementation -
The implementation used where I work uses about 10 columns in the table: CUSTOMFIELD1,

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.