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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:42:19+00:00 2026-05-25T14:42:19+00:00

i know this issue was discussed many times before , but i have a

  • 0

i know this issue was discussed many times before , but i have a simple question.
after reading all the apple’s rules to manage the memory, i know this :

if i allocate an object , i own it and have to release it . so i have to do :

ran *me = [[ran alloc] init];
//do somthing
[me release];

so now , the retain count is 0, after i release ran object.

BUT i was also read that when retain count of an object is 0, the dealloc method is being invoked .

so my question is, after i took down the retain count to 0, DO i have to release again the object at the dealloc?

-(void)dealloc
[me release];

or that the first release did the job ?
otherwise, why dealloc is being called anyway ? if the retain count=0 we are ok no ??

thanks a lot .

  • 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-25T14:42:20+00:00Added an answer on May 25, 2026 at 2:42 pm

    No, you do not need to release again in there – in fact, don’t do it!

    The reason dealloc is being called is so that clean-up may occur. For example, if you allocated memory in your class, you can free it up there. And remember that the retain count could reach 2, 3, 4, 5…. so just because a release is done, you don’t (as an outside user of the class) know that the dealloc should be called. That’s how it is different than a release.

    One thing to note is that the dealloc method may not be immediately run when the count hits 0. It could be done much later.

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

Sidebar

Related Questions

I know this has been discussed ad nauseum...but I have an issue with the
I know this issue has been discussed numerous times, but I think this is
I know many have asked this question, but I think my situation is a
I know this issue has been touched on here but I have not found
I know this issue being mentioned before, but resolutions there didn't apply. I'm having
I don't know if anyone has seen this issue before but I'm just stumped.
I do not currently have this issue , but you never know, and thought
I know there is already a question about this but my issue is more
I know this issue should be fixed with System.setProperty(http.keepAlive, false); before openConnection, but that
Gday All, I know this issue is well known, however I have searched high

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.