• 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
Re: NSString or NSMutableString?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSString or NSMutableString?


  • Subject: Re: NSString or NSMutableString?
  • From: Andreas Monitzer <email@hidden>
  • Date: Sat, 22 Jun 2002 10:52:38 +0200

On Saturday, June 22, 2002, at 10:29 , Lorenzo Puleo wrote:

I have a variable instance NSString "gErrString".
After the first assignment in the awakeFromNib routine:
gErrString = @"something";

I use that several times to compile a log report this way:
gErrString = [gErrString stringByAppendingString:@"something"];

So, at the I get a very large string. I want this. But...
Could this cause a lack of memory?

no, unless you create millions of them

Could this produce several, say, "pointers", lost in the memory space?

no, try to understand how NSAutoreleasePool works.

Should I have to use instead a NSMutableString? e.g.
In the first assignment in the awakeFromNib routine:
gErrString = [NSMutableString stringWithCapacity:0];
[gErrString setString:@""];

and then set it for several times? e.g.
[gErrString appendString:@"something"];

You should reformulate that question:
I have to append a string. Now should I use NSMutableString, which was designed for appending strings, or should I use -[NSString stringByAppendingString:], which constantly creates new objects for one-time-use?

andy
--
DigiTunnel 1.0 released, offering full PPTP-support for Mac OS X!
http://www.gracion.com/vpn/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >NSString or NSMutableString? (From: Lorenzo Puleo <email@hidden>)

  • Prev by Date: Re: Protecting Software w/ Software License Keys...
  • Next by Date: Carbon Events in a Cocoa App
  • Previous by thread: NSString or NSMutableString?
  • Next by thread: Carbon Events in a Cocoa App
  • Index(es):
    • Date
    • Thread