Re: NSReleasePool issue
Re: NSReleasePool issue
- Subject: Re: NSReleasePool issue
- From: Kyle Sluder <email@hidden>
- Date: Sat, 21 Jun 2014 07:39:57 -0700
You should add the @autoreleasepool around NSApplicationMain. I don't know why it's missing from the Mac template.
--Kyle Sluder
On Jun 21, 2014, at 12:24 AM, Varun Chandramohan <email@hidden> wrote:
>
> This is OS X not iOS. Yes main look like what is shown below without the autoreleasepool.
> ________________________________________
> From: Sean McBride <email@hidden>
> Sent: Saturday, June 21, 2014 2:39 AM
> To: Steve Christensen; Varun Chandramohan
> Cc: Cocoa-Dev List
> Subject: Re: NSReleasePool issue
>
> Given the backtrace, I'd say the OP is using Mac OS, not iOS. I just created a new project in Xcode, and main() looks like this on OS X:
>
> int main(int argc, const char * argv[])
> {
> return NSApplicationMain(argc, argv);
> }
>
>
> On Fri, 20 Jun 2014 09:32:48 -0700, Steve Christensen said:
>
>> My main() looks like this. Does yours specify an autorelease pool?
>>
>> int main(int argc, char* argv[])
>> {
>> @autoreleasepool
>> {
>> return UIApplicationMain(argc, argv, nil, @"MyDelegateClassName");
>> }
>> }
>>
>>
>> On Jun 19, 2014, at 5:45 PM, Varun Chandramohan
>> <email@hidden> wrote:
>>
>>> I was playing around with OBJ_DEBUG_MISSING_POOL env variable and set
>> it to YES. I was able to debug most of the issues in my code where I
>> missed auto release pools. This is the last one remaining. However I am
>> not sure where the leak is happening. It looks like NSApplicationMain,
>> do that also need this auto release pool?
>>>
>>> objc[26109]: MISSING POOLS: Object 0x6180000410e0 of class
>> NSUserDefaults autoreleased with no pool in place - just leaking - break
>> on objc_autoreleaseNoPool() to debug
>>>
>>> (lldb) bt
>>>
>>> * thread #1: tid = 0x3d3c5f, 0x00007fff91da8604
>> libobjc.A.dylib`objc_autoreleaseNoPool, queue = 'com.apple.main-thread',
>> stop reason = breakpoint 1.1
>>> frame #0: 0x00007fff91da8604 libobjc.A.dylib`objc_autoreleaseNoPool
>>> frame #1: 0x00007fff91d95488 libobjc.A.dylib`(anonymous
>> namespace)::AutoreleasePoolPage::autoreleaseSlow(objc_object*) + 72
>>> frame #2: 0x00007fff91da8781 lib
>> objc.A.dylib`_objc_rootAutorelease2(objc_object*) + 75
>>> frame #3: 0x00007fff895528a3 AppKit`_NSGetBoolAppConfig + 85
>>> frame #4: 0x00007fff89571566 AppKit`-[NSApplication
>> _installMemoryPressureDispatchSources] + 161
>>> frame #5: 0x00007fff89565861 AppKit`-[NSApplication run] + 206
>>> frame #6: 0x00007fff895507a3 AppKit`NSApplicationMain + 940
>>> * frame #7: 0x0000000100002022 TOS`main(argc=3,
>> argv=0x00007fff5fbffa90) + 34 at main.m:13
>
>
>
> _______________________________________________
>
> 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
_______________________________________________
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