Autorelease question
Autorelease question
- Subject: Autorelease question
- From: Dmitry Markman <email@hidden>
- Date: Thu, 3 Apr 2008 20:03:32 -0400
Hi
How can I tell that default autorelease pool exists?
here is why I ask
Aaron Hillehass in his book, said that if object wasn't created with
alloc, new, copy or mutableCopy then that object will be added
to the default autorelease pool
and indeed, in the simple guiless Cocoa application
if I try to call, for example,
NSString *textString = [NSString stringWithCString:"Hello
From Cocoa" encoding:NSMacOSRomanStringEncoding];
without cretaing NSAutoreleasePool
I'll get
2008-04-03 19:59:00.833 NSArrayTest[57600:10b] ***
_NSAutoreleaseNoPool(): Object 0x1099e0 of class NSCFString
autoreleased with no pool in place - just leaking
but from other hand in the complex Carbon application, where I never
explicitly created NSAutoreleasePool object
I can call
NSString *textString = [NSString stringWithCString:"Hello
From Cocoa" encoding:NSMacOSRomanStringEncoding];
without any warnings about _NSAutoreleaseNoPool
so I suppose default NSAutoreleasePool was created for me
so how I can verify it?
thanks
Dmitry Markman
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden