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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:01:17+00:00 2026-05-30T09:01:17+00:00

I assign here on a an Object a derivative of the same object. Is

  • 0

I assign here on a an Object a derivative of the same object. Is there any problem with this?

NSString *urlString =[TBXML textForElement:tempElement];
urlString = [urlString stringByReplacingOccurrencesOfString:@" " withString:@"%20"];
urlString = [urlString stringByReplacingOccurrencesOfString:@"&" withString:@"&"];
  • 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-30T09:01:18+00:00Added an answer on May 30, 2026 at 9:01 am

    Yes, that’s fine. After running this code, there will be three NSString objects in memory:

    1. The one created by [TBXML textForElement:tempElement]
    2. The one created by [urlString stringByReplacingOccurrencesOfString:@" " withString:@"%20"]
    3. The one created by [urlString stringByReplacingOccurrencesOfString:@"&" withString:@"&"]

    Each of them will have a retain count of 1 but will be autoreleased. Since you don’t keep references to 1. or 2., there’s no way you’ll be able to increase their retain counts afterwards, so at the end of the current iteration of the run loop they will be autoreleased, their retain counts will go to 0, and they will be deallocated.

    The third one is in the same boat, but you do have a reference to it, so if you do something to increase its retain count (e.g., assign it to a strong @property or add it to an NSArrray) then it may continue to exist after this iteration of the run loop. Or, if you’re just using it as a parameter to some function (maybe you just use it in NSString stringWithFormat: later on, it will get deallocated along with the other two.

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

Sidebar

Related Questions

I need to assign a custom property to a jQuery object. Here is the
I want to assign an object to volatile object in the same type, but
here's the scenario: I foolishly forget to assign the returned object to a variable:
is it possible to assign the $this object to a new instance of a
I want to assign the decimal variable "trans" to the double variable "this.Opacity". decimal
I want to assign a class attribute via a string object - but how?
For some reason @store object with three attributes won't assign the third value(generated token
Assign object literal properties var foo = { bar : 'hello'}; Ternary var cats
I have read the question here: Is it problematic to assign a new value
Question: How do you assign a material with a script to an object in

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.