• 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: NSXMLParser in background thread crashing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSXMLParser in background thread crashing


  • Subject: Re: NSXMLParser in background thread crashing
  • From: Sherm Pendley <email@hidden>
  • Date: Fri, 23 Feb 2007 10:36:15 -0500

On Feb 23, 2007, at 9:21 AM, Justin R. Miller wrote:

On Feb 23, 2007, at 8:54 AM, Sherm Pendley wrote:

I'm not sure what sort of reasoning leads you to think that creating a new class is simpler than adding a method to an existing class - but anyway, that's not important.

Are you speaking of a category here? I'm trying to learn how else I could have accomplished this. Are you suggesting a category with a new method that calls [super parse] after seeing up the pool? I realize this whole approach is moot now, but I'm trying to learn something here.

Presumably you're calling -parse from an existing class. I don't see how it would be any more difficult to add a method to that class than it would be to create a new subclass or a category. Not that I'm suggesting one or the other would be better; that would depend on your app's overall design. I'm just saying that in terms of simplicity, there's not much difference.


You need to create such a method for reasons beyond just memory management, and where you create it doesn't really matter. What *does* matter is that it has the proper signature, and -parse doesn't.

Understood -- thanks for this insight. What are the practical ramifications of the way I've done it?

C - and by extension, Objective-C - is a "stack-based" language. What that means is that when a method is called, arguments are pushed onto the stack, and the return value popped off of the stack. Space for local variables must also be allocated on the stack.


So the caller needs to know more than just the memory address of the called method; it also has to be aware of how this "stack frame" is to be constructed. If it doesn't, Bad Things can happen. Pointers to invalid memory locations, numbers with incorrect values, even so- called "stack smashing" security problems.

For details on exactly what happens (at the assembly level) to the stack when a function or method is called, have a look at the ABI documentation:

<file:///Developer/ADC Reference Library/documentation/ DeveloperTools/Conceptual/LowLevelABI/index.html>

... or online at:

<http://developer.apple.com/documentation/DeveloperTools/Conceptual/ LowLevelABI/index.html>

sherm--

Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: 
 >NSXMLParser in background thread crashing (From: "Justin R. Miller" <email@hidden>)
 >Re: NSXMLParser in background thread crashing (From: Jim Correia <email@hidden>)
 >Re: NSXMLParser in background thread crashing (From: "Philip Q" <email@hidden>)
 >Re: NSXMLParser in background thread crashing (From: "Justin R. Miller" <email@hidden>)
 >Re: NSXMLParser in background thread crashing (From: Sherm Pendley <email@hidden>)
 >Re: NSXMLParser in background thread crashing (From: "Justin R. Miller" <email@hidden>)

  • Prev by Date: Re: PackageMaker. How to start application after closing installer.
  • Next by Date: [Moderator] EOT Re: PackageMaker. How to start application after closing installer.
  • Previous by thread: Re: NSXMLParser in background thread crashing
  • Next by thread: Re: NSXMLParser in background thread crashing
  • Index(es):
    • Date
    • Thread