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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:08:15+00:00 2026-06-05T23:08:15+00:00

I was reading document about ARC and came across a part which confused me.Please

  • 0

I was reading document about ARC and came across a part which confused me.Please can anyone help me.
I have two questions:
1.I know ARC release object when no variable is pointing to it.Now suppose I have some method say:(NSString *)returnString, whose return type is NSSTring;So what will happen to the variable which is declare in the method returnString?I know the receiving variable will get release when it comes out of scope of the method where returnString is called but what will happen to the variable which is inside returnString.

-(NSSTring *)returnString
{
   NSString *str = //Some value;

   return str;//What will happen to this.
}

and
Other method:

-(void)useString
{
   NSString *str1 = [self returnString];  //It will get release when this method gets over.
}

2.What will happen if returnString is in some third party library which isn’t compiled with 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-05T23:08:17+00:00Added an answer on June 5, 2026 at 11:08 pm

    For your first question, ARC will take care of retaining and releasing for you. Any time you’re still maintaining a reference to a variable, ARC should be holding on to it. In your specific example the string will likely be returned as an autoreleased object, but the actual implementation is hidden from you.

    For your second question, you can mark libraries as not using ARC in order to keep manual retain/release. To do so, see this question: ios5 ARC what is the compiler flag to exclude a file from ARC?

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

Sidebar

Related Questions

I'm reading some documents about both Servlets and PHP. These document have the same
I was reading my trusty O'Reilly book and came across a passage about how
I was reading through this document http://llvm.org/docs/WritingAnLLVMPass.html , where in I came across CallGraphSCCPass
I have been reading about setInterval and came up with my own way to
I was reading about document fragments and DOM reflow and wondered how document.createDocumentFragment differed
For years I've been reading about XML and I have just not quite grokked
I've been reading a bit about document design for MongoDB, specifically relating to referencing,
I have been reading on the different question talking about selecting unique nodes in
I am reading a document about C++ vs C. The document says C++ is
I've been reading a lot of stuff about functional programming lately, and I can

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.