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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T09:09:15+00:00 2026-05-19T09:09:15+00:00

Declaration. @property (nonatomic, retain) footballResultsParser * FBRP; Method of alloc. -(void) viewDidLoad { if

  • 0

Declaration.

 @property (nonatomic, retain) footballResultsParser * FBRP;

Method of alloc.

-(void) viewDidLoad
 {
    if (FBRP == nil)
    {
     FBRP = [[footballResultsParser alloc] init];
     [FBRP updateResults];
    }
  }

Is that the proper and safe way you alloc objects in your viewDidLoad?
I assume its possible that viewDidLoad will get called more than once and the object might already exists.

To dealloc safely.

-(void) dealloc
{
    if (FBRP != nil)
    {
     [FBRP release];
    }
}

Is there a better way to do memory management that this?

  • 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-19T09:09:16+00:00Added an answer on May 19, 2026 at 9:09 am

    You should also release them in viewDidUnload. For reference, here is the related documentation in the UIViewController class reference.

    When a low-memory warning occurs, the
    UIViewController class purges its
    views if it knows it can reload or
    recreate them again later. If this
    happens, it also calls the
    viewDidUnload method to give your code
    a chance to relinquish ownership of
    any objects that are associated with
    your view hierarchy, including objects
    loaded with the nib file, objects
    created in your viewDidLoad method
    ,
    and objects created lazily at runtime
    and added to the view hierarchy.
    Typically, if your view controller
    contains outlets (properties or raw
    variables that contain the IBOutlet
    keyword), you should use the
    viewDidUnload method to relinquish
    ownership of those outlets or any
    other view-related data that you no
    longer need.

    Btw, when releasing, you don’t have to check if the object is nil. Sending messages to nil does nothing, it’s safe.

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

Sidebar

Related Questions

I have Question related to nsdate declaration. NSDate *sortDate; @property(nonatomic,retain) NSDate *sortDate; @synthesize sortDate;
With this method declaration (no overloads): void Method(double d) { // do something with
I've seeen the following snippet quite a bit: In the header: SomeClass *bla; @property(nonatomic,retain)
Given the property declaration below, does method (A) work in exactly the same way
i have the following property declaration Public Property IsAreaSelected() As Integer Get Return If(ViewState(IsAreaSelected)
Why we donot need to specify ; after an automatic property declaration public string
Declaration: I am not sure if that is a parameter. Please enlighten. I have
I have a class MyCLController with a property dataSource that is data source delegate
If I declare an ivar without property declaration, and this ivar could be used
The standard declaration for an autogenerated NSManagedObject property declares to-many relationships like this: @property

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.