Re: NSString or NSMutableString?
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.