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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:32:22+00:00 2026-06-18T01:32:22+00:00

If I have the below property: @property (nonatomic, retain) MyObject *theObject; then if I

  • 0

If I have the below property:

@property (nonatomic, retain) MyObject *theObject;

then if I want to create a new MyObject, do I:

self.theObject = [[MyObject alloc] init];

or:

self.theObject = [[[MyObject alloc] init] autorelease];
  • 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-18T01:32:23+00:00Added an answer on June 18, 2026 at 1:32 am

    You have to use autorelease. If you don’t, the object will have a release count of two (one from alloc, one from the retain by the setter), so when the property is unset, it’ll be leaked.

    This only applies to strong or retained and copy properties. Assigned and weak properties should just be assigned an alloc-initted object, since they don’t alter its reference count.

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

Sidebar

Related Questions

I have following code with following xib: @property (nonatomic, retain) IBOutlet UITableViewCell *cellLoadMore; When
I'm wondering about the .childNodes property, I have the code below, and for some
I have an Item Writer as below: <beans:property name=lineAggregator> <beans:bean class=org.springframework.batch.item.file.transform.FormatterLineAggregator> <beans:property name=fieldExtractor> <beans:bean
I have an object that I init like so: pdtd = [[ProfileDataTableDelegate alloc] initWithTableView:profileDataTableView
I have a problem sending POST request with VB6. The code below works properly
I have below structure <div class=mybox> <div id=imageslide> <a href=><img src=url /></a> </div> </div>
I have below snippet of code in which TestClass is extending jPanel which is
I have below code: <a href=# id=@item.Id name=vote ><img src=/Content/images/021.png style=float:left alt= /></a> which
I have below code: class Program { static void Main(string[] args) { Task[] tasks
I have below sample data. AID Date Title ----- ---------- ------ 1 2011-12-12 test1

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.