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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:44:16+00:00 2026-05-29T22:44:16+00:00

I usually release the object after use by [myObject release]; But I found in

  • 0

I usually release the object after use by

[myObject release];

But I found in some online tutorials that they assign a nil after releasing the object. Like

[myObject release];
myObject = nil;

Is it required?

  • 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-29T22:44:17+00:00Added an answer on May 29, 2026 at 10:44 pm

    It’s a long-running debate as to whether setting the pointer to nil after releasing is necessary, but I come down on the side of it being a good idea.

    After the object is released, the pointer you hold to it still points to the same place. If your release has taken the retain count to 0 then the object will be deallocated. If you then try and send a message to the deallocated object you’ll get an EXC_BAD_ACCESS error. However, sending a message to the pointer after it’s been set to nil won’t error – it just won’t do anything.

    The other side of the argument is that if you’re messaging a deallocated object it’s good to know about it and fix your code to make sure it doesn’t happen.

    There are smart people in both camps.

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

Sidebar

Related Questions

Usually when we push viewcontroller, we will create object for view controller, after that
ILMerge usually merges my assemblies fine when building a Release, but when Publishing for
Usually I write programs without the ARC but I have inherited an application that
Usually i'm using cherokee. Due to some critical issues with the latest chrome release
I must admit, that usually I haven't bothered switching between the Debug and Release
OS (usually security-based) patches and hotfixes that Microsoft releases to the community normally consist
Usually, when using Windows Authentication, the software (eg Internet Explorer) tries to use Windows
I finally understand whether I must release an object, and how to keep my
Multi-threading usually means locking critical sections, etc. So I can't help but wonder, in
When implementing reference counting in objects the release and possibly delete object primitive is

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.