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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:14:16+00:00 2026-06-09T22:14:16+00:00

The way I understand auto reference counting is this: If an object is going

  • 0

The way I understand auto reference counting is this:

If an object is going to be consumed by various classes, it should be type “strong” so that it stays around while others might be doing stuff with it.

If an object is simply an internal structure for a class, it can be type “weak”, because it will go away once the current class implementation is done dealing with it.

Is there more to it than this?

Here is an example of what I imagine:

#import "World.h"
@interface Foo : NSObject
@property (nonatomic, strong) NSArray *barArray;
@property (nonatomic, weak) NSString *bazString;
@end

@implementation Foo
-(void)sendTheArrayIntoTheWorld {
    self.barArray = [NSArray arrayWithObject:@"lonely item"];
    [World takeTheArray:self.barArray]; // array is strong so it can exist indefinitely
}

-(void)useThatString {
    self.bazString = "weak old string"; // string is weak because it should be discarded when it's no longer needed here...
}
@end
  • 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-09T22:14:18+00:00Added an answer on June 9, 2026 at 10:14 pm

    This isn’t exactly how ARC works. It boils down to this:

    • Strong references are the only ones that keep objects alive
    • An object needs at least one strong reference to remain alive
    • Weak references do not keep objects alive- if there are 100 weak references to an object but no strong references, then the object will be released
    • Assigning a value to a weak property without referencing it elsewhere will result in its immediate deallocation, as with your bazString. If you try accessing that string after you assign it a value (unless it is being owned by another object, like an array, which it is not in your case), you’ll find that it is nil.

    This means that weak references should be used for objects that you don’t necessarily ‘control,’ like delegates. If you use a strong reference for a delegate and the delegate has a strong reference on you, then neither object will ever be deallocated. This is called a retain cycle.

    If you need an object to stay alive until you are done with it, use strong. Otherwise, use weak.

    You can read much more about the intricacies and features of ARC here.

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

Sidebar

Related Questions

Okay this is definitely a n00b question but here goes. The way I understand
I am migrating an app to the High-Replication datastore. The way I understand that
The basic way that I understand Shiro's SecurityUtils.getSubject() to work is that it returns
I am tired of working this out myself , i cannot understand the way
I understand that the best way to develop a free and paid version of
From what I understand there is no way of type-checking the messages send in
I do understand that functions should not return references to automatic variables. However I
The way I understand it, we are encouraged to name Ember instances lowercase: App.mailtruck
I understand the way Mealy state machines work - the output logic is now
I have been trying to understand the way ActionScript's events are implemented, but I'm

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.