On 4 Apr 2008, at 1:32 PM, Chris Suter wrote:

On 04/04/2008, at 1:25 PM, Dmitry Markman wrote:

how can you explain that
NSString *nsFontName = [NSString stringWithCString:fontName encoding:NSMacOSRomanStringEncoding];
can be released, but
NSString *textString = [NSString stringWithCString:"Hello From Cocoa" encoding:NSMacOSRomanStringEncoding];
can not
so what's the difference?

Neither of them should be released; there's no difference.

Nobody wants to answer memory management questions on this list, not least because it's better said in the documentation. It's very comprehensively covered in the documentation so please take the time to read and understand them.

There was a previous thread that talked about this issue with the subject "Garbage collection - was Beginner with Cocoa". I'd suggest you read through that too. It starts here:

  http://lists.apple.com/archives/cocoa-dev/2008/Mar/msg01922.html

That thread gives a few good links to Apple's documentation on the subject. I'll provide the links here to make it easy:

  
http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaObjects/chapter_3_section_5.html
  
http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Concepts/ObjectOwnership.html
  
http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmPractical.html
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to