Re: [newbie] NSString code so it won't leak, again
Re: [newbie] NSString code so it won't leak, again
- Subject: Re: [newbie] NSString code so it won't leak, again
- From: Jeff LaMarche <email@hidden>
- Date: Tue, 10 Sep 2002 07:43:57 -0700 (PDT)
Hmmm...
Here's my take, although someone more experienced can (and certainly will =) ) correct me if I'm wrong: I don't think your first version is actually leaking. I'm assuming from your first code sample that you're using an NSString constant in Cocoa just as you did with your first pseudo-code example (NSString *myString = @"REALLY LONG...STRING";) Here's what the docs say about NSString constants (@"xxx"):
"Such an object is created at compile time and exists throughout your program's execution. The compiler makes such object constants unique on a per-module basis, and they're never deallocated (though you can retain and release them as you do any other object)."
Therefore, it's going to hang around no matter what you do... it's never deallocated even if you release it, so don't worry about fixing it...
Jeff
_______________________________________________
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.