• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Nested AutoRelease Pools Crash
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Nested AutoRelease Pools Crash


  • Subject: Re: Nested AutoRelease Pools Crash
  • From: Trygve Inda <email@hidden>
  • Date: Sun, 26 Apr 2009 17:41:09 +0000
  • Thread-topic: Nested AutoRelease Pools Crash

> 2009/4/26 Trygve Inda <email@hidden>:
>> - (void)threadMethod:(id)anObject
>> {
>>   NSAutoreleasePool* outterPool = [[NSAutoreleasePool alloc] init];
>>
>>   NSDictionary*    userDefaults = [NSUserDefaults standardUserDefaults]
>>   importantValue = [[userDefaults objectForKey:@"myKey"] boolValue];
>>
>>    while (1)
>>    {
>>        NSAutoreleasePool* innerPool = [[NSAutoreleasePool alloc] init];
>>
>>        if (![self threadMustExit])
>>            [self doStuffWith:importantValue];
>>        if (![self threadMustExit])
>>            [self doMoreStuff];
>>        if (![self threadMustExit])
>>            [self doEvenMore];
>>
>>        [innerPool release];
>>
>>        if ([lock lockWhenCondition:kConditionThreadMustExit])
>>        {
>>            [lock unlock];
>>            break;
>>        }
>>    }
>>
>>    [lock lock];
>>    [lock unlockWithCondition:kConditionThreadIdle];
>>
>>    [outterPool release];
>> }
>>
>>
>> This crashes the second time through the loop (when innerPool is being
>> created for the second time). Why?
>
> How about posting your real code instead of a weird paraphrase? This
> won't even compile. Aside from the obvious doMoreStuff methods in the
> middle, the lockWhenCondition: method returns void, so if ([lock
> lockWhenCondition:kConditionThreadMustExit]) is not going to compile.
> It's impossible to diagnose a problem when we're not even looking at
> the same code as the code that crashes.

Sorry - the real code is huge and hard to narrow down - working on it.


_______________________________________________

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

References: 
 >Re: Nested AutoRelease Pools Crash (From: Michael Ash <email@hidden>)

  • Prev by Date: NSTask, or threading?
  • Next by Date: Re: Nested AutoRelease Pools Crash
  • Previous by thread: Re: Nested AutoRelease Pools Crash
  • Next by thread: Re: Nested AutoRelease Pools Crash
  • Index(es):
    • Date
    • Thread