• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Memory management of NSStrings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Memory management of NSStrings


  • Subject: Memory management of NSStrings
  • From: John James <email@hidden>
  • Date: Sun, 10 Apr 2005 07:43:01 -0400

I am still in my 1st year of learning so bear with me.

I finally got this part of my program working, but I am not sure why.
I have a method which creates a small report in a NSString* which is later 
shown in a window.  

I do something like this:

    NSString* rpt =  @"#session( \r";

and then multiple lines of the sort:

    rpt = [rpt stringByAppendingString : objectString];
where objectString is built up in a similar way to make an report record.

finally I return rpt.

However it seems from my reading I should give a "[rpt autorelease]" before I return,
but if I do I get a double release error.  I can not find anything in the
documentation or my many books explaining how rpt gets into the autorelease pool
automatically, but I guess it does. And I probably missed it.  Could someone give me
a reference or a general rule when this happens.


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Memory management of NSStrings
      • From: Shawn Erickson <email@hidden>
    • Re: Memory management of NSStrings
      • From: Finlay Dobbie <email@hidden>
    • Re: Memory management of NSStrings
      • From: Matteo Ceruti <email@hidden>
  • Prev by Date: Re: Bindings - necessary to manually inform of updates?
  • Next by Date: Re: Memory management of NSStrings
  • Previous by thread: Re: Bindings - necessary to manually inform of updates?
  • Next by thread: Re: Memory management of NSStrings
  • Index(es):
    • Date
    • Thread