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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:19:58+00:00 2026-05-13T17:19:58+00:00

Sometimes when coding in Objective C for the iPhone I wonder if I should

  • 0

Sometimes when coding in Objective C for the iPhone I wonder if I should release an object in dealloc or is it sometimes better to release in viewWillDisappear if that view is a separate rarely used part of your app.

Thanks.

  • 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-13T17:19:58+00:00Added an answer on May 13, 2026 at 5:19 pm

    Well first off, you probably want to release things in viewDidDisappear: (after they are off screen), not viewWillDisappear: In any event, you should probably release it in both viewDidDisappear: and dealloc …

    In viewDidDisappear: you should release anything you don’t need while you are off screen in order to save memory. In dealloc you should release everything your object could possibly have retained. You want to do this regardless of whether you potentially released it in viewDidDisappear:, in case your code entered through a weird path where viewDidDisappear: is not called. That might happen in the future when you reuse the view controller in a different context, or when Apple changes something about the collection view controllers you are housing your VC in.

    So long as you are appropriately nil-ing out the ivars after you release them (which should be automatically happening if you are using properties) then over releasing will not be an issue because if you release it in both places the second release will end up sending the release message to nil.

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

Sidebar

Ask A Question

Stats

  • Questions 507k
  • Answers 507k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Do it like this: myDataGridView1.AllowUserToAddRows = false May 16, 2026 at 4:07 pm
  • Editorial Team
    Editorial Team added an answer If you only want to perform an action when the… May 16, 2026 at 4:07 pm
  • Editorial Team
    Editorial Team added an answer What you have described is the Chain of Responsibility Pattern… May 16, 2026 at 4:07 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

As I do my coding I sometimes wonder if I'm doing things the best
Sometimes, while coding in PHP we get parse or syntax errors like those: Parse
Sometimes, when coding in RAD Studio 2009 (Delphi), suddently the behaviour of the code
I use Emacs primarily for coding Python but sometimes I use IDLE. Is there
In my coding environment I've got a dev, test and production machine. Sometimes I
Sometimes it can be confusing reading code in instance members that refers to other
Sometimes, I come across certain web development frameworks which don't provide an authentication feature,
Project Euler and other coding contests often have a maximum time to run or
What is the best practice/coding standard with regard to the this scope is AS3?
Iam coding a solution for web automation, I have been using the default web

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.