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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T02:35:33+00:00 2026-06-07T02:35:33+00:00

I faced a very interesting situation and do not know how to resolve it.

  • 0

I faced a very interesting situation and do not know how to resolve it. I’ll outline first the architecture of my program. I have a UITableViewController derived class that also implements a my delegate protocol. The cells in this table view are custom cells, and each of them have a strong (assign) type property to the delegate (the table view controller). The delegate handle some UI action.

To reproduce the crash, I load the table view, and then navigate away from it. Normally here the table view would be dealloced but in my case the cells still hold the strong reference to it, so it remains in the memory. The problem is that I get a crash when a memory warning arrives to the device after this. I deducted that the following happens:

  • the table view controller receives a memory warning
  • the it releases all their (reusable) cells
  • in the dealloc of the cells I nil the delegate property, thus they send a release to the table view controller.
  • when the last cell nils its property, the ref count of the table view reaches zero, so it will dealloc itself
  • after freeing the cells, the default implementation of didReceiveMemoryWarning of the table view continues, but already on a dealloced, zombie object
  • sometimes later it calls viewDidUnload on the zombie and it crashes the app.

How can I resolve this situation?

PS: obviously I don’t use ARC

  • 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-06-07T02:35:34+00:00Added an answer on June 7, 2026 at 2:35 am

    When you’re setting a delegate, you should assign it, not retain it (and so the deallocation of the cells should not send a release message to the table view controller).

    Delegating objects do not (and should not) retain their delegates.
    However, clients of delegating objects (applications, usually) are
    responsible for ensuring that their delegates are around to receive
    delegation messages. To do this, they may have to retain the delegate
    in memory-managed code. This precaution applies equally to data
    sources, notification observers, and targets of action messages. Note
    that in a garbage-collection environment, the reference to the
    delegate is strong because the retain-cycle problem does not apply.

    From Concepts in Objective-C Programming

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

Sidebar

Related Questions

I have faced a very strange situation here. I am accessing database (MDB) through
I faced a very interesting fact, and hope you have an answer for that.
My question is really very important . When i program i have seen that
Here is a very simplified program which reproduces the issue I faced in the
I have found this site very useful for all my previously faced problems, However
Today I have faced very strange behavior of sqlite3_finalize statement. I am using sqlite
We were faced with very strange issue that made us crazy. Sometimes newly created
I faced SSLHandshakeException on Heroku. This app was not SSL app. But this app
I faced a problem while using threading for the first time, In an SWT
I work for a very small company. I was recently faced with the question

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.