• 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: Cocoa Newbie Thread/Memory Problems
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cocoa Newbie Thread/Memory Problems


  • Subject: Re: Cocoa Newbie Thread/Memory Problems
  • From: Quincey Morris <email@hidden>
  • Date: Tue, 16 Mar 2010 15:44:16 -0700

On Mar 16, 2010, at 14:38, Dave wrote:

> 			myURLString = [self myURLString:kBaseURL ForDate:myCurrentDate UsingDatabase:@"rs_main"];

Do you mean 'self makeURLString:', the method whose implementation you showed?

> 			[mParserBase myURLString ForStructure:kField_List];

This won't even compile, so your actual code must be something else.

> Now when I run it, I get a crash on the second iteration of the loop. I'm guessing because I am starting another thread before the first one has finished. In general, what is the best way to handle this? What would happen if I were only doing one iteration, but the User Clicked the button before the first event had finished?

I'm not sure what you're referring to by "thread" and "event". The code you've shown doesn't have anything to do with multiple threads, or events.

If you get a crash (especially a repeatable crash), you should first check the run log window to see if there are any error messages. Then note the type of crash, and examine the backtrace from the debugger to find the line the error occurred on, and what it was trying to do. The crash just indicates you have a bug -- it's too early to conclude that you need to use a different approach.

My guess is that you're using some asynchronous mechanism for retrieving your data, and this is exposing a memory management bug elsewhere in the code. For example, if you're calling something that causes the autorelease pool to be drained during your 'for' loop, the object in myCurrentDate is going to be deallocated because you didn't assume ownership of (that is, retain) the instance you got.


_______________________________________________

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

  • Follow-Ups:
    • Re: Cocoa Newbie Thread/Memory Problems
      • From: Dave <email@hidden>
References: 
 >Cocoa Newbie Thread/Memory Problems (From: Dave <email@hidden>)
 >Re: Cocoa Newbie Thread/Memory Problems (From: Quincey Morris <email@hidden>)
 >Re: Cocoa Newbie Thread/Memory Problems (From: Dave <email@hidden>)

  • Prev by Date: Re: Nil items in NSMutableSet
  • Next by Date: Re: Nil items in NSMutableSet
  • Previous by thread: Re: Cocoa Newbie Thread/Memory Problems
  • Next by thread: Re: Cocoa Newbie Thread/Memory Problems
  • Index(es):
    • Date
    • Thread