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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:10:48+00:00 2026-05-25T17:10:48+00:00

Typical dealloc Well it sucks. What about if I forget a property to dealloc?

  • 0

Typical dealloc

Well it sucks. What about if I forget a property to dealloc?

Why can’t we have something like dealloc All properties

Worst of all, I sort of like the way viewControllers are handled now. We put a property and poof the dealloc is put. Can’t have that on normal classes ha?

- (void)dealloc
{
    [_window release];
    [__managedObjectContext release];
    [__managedObjectModel release];
    [__persistentStoreCoordinator release];
    [_MainBadgerApplication release];
    [_SettingsMiscelaneous release];
    [_theNearByIsiKota release];
    [Customcell release];
    [PhoneCC release];
    [searchViewController release];
    [_superTabBar release];
    [_SuperNavBar release];
    [pinNumberView release];
    [_lblForPinNumber release];
    [navController release];
    [NearbyShortcut release];
    [_searchListView release];
    [_searchNearView release];
    [LoadingView release];
    [super dealloc];
}

I am thinking of a macro where I can just do

myDealloc

and that will enumerate all properties and release them one by one or set them to nil (which is almost equivalent)

  • 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-25T17:10:48+00:00Added an answer on May 25, 2026 at 5:10 pm

    This looks like a horrible idea, so here is the code 😀 This will step through every object property on your code and send a release. I didn’t compile it, but it’s more or less like this.

    #import <objc/runtime.h>
    
    unsigned int propertyCount;
    objc_property_t *properties = class_copyPropertyList([self class], &propertyCount);
    for (unsigned int i = 0; i < propertyCount; i++)
    {
        SEL sel = @selector(release);
        const char *attr = property_getAttributes(properties[i]);
        switch (attr[1]) {
            case '@':
                property_getName(properties[i]), objc_msgSend(self, sel)]
                break;
            default:
                break;
        }
    }
    free(properties);
    

    You can wrap it in a C function and call it from your dealloc.

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

Sidebar

Related Questions

Typical scenario: a class that a lot of people have worked on. I'd like
Typical Event Log message looks like below. There you can find very interesting fields
Typical usage scenario: I have master, branch_foo and branch_bar. All are up to date.
Consider some typical CF code involving error handling, say something like this: ABRecordRef aRecord
I have the typical association HABTM Item <-> Tag If i get all the
Typical way of creating a CSV string (pseudocode): Create a CSV container object (like
Typical jQuery over-use: $('button').click(function() { alert('Button clicked: ' + $(this).attr('id')); }); Which can be
The typical ConfigParser generated file looks like: [Section] bar=foo [Section 2] bar2= baz Now,
I have a typical reporting application: Large report <-- HTTP Compression --> ASP.NET Web
I have a typical server in my end and a friend using a client

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.