• 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 frees itself on error?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSXMLParser frees itself on error?


  • Subject: Re: NSXMLParser frees itself on error?
  • From: Marcel Weiher <email@hidden>
  • Date: Thu, 7 May 2009 10:05:29 -0700


On May 7, 2009, at 9:43 , Jeff Johnson wrote:

You misunderstand my argument. I'm not claiming that autorelease provides some magical guarantee.

Actually, you were initially claiming that there was such a guarantee, and misquoting the docs to 'prove' your point.


I'm claiming that you ought to write your code to provide the guarantee. So, for example, don't wrap delegate callbacks in autorelease pools. There's no need to 'clean up' after your delegate, as you say. This is a not only a misapplication of memory management responsibility, but it can lead to unintended and very bad side effects.

That's an, er, interesting opinion.


Furthermore, I think you can count on Apple to not do anything like that (and if they do, it's a bug they ought to fix). Why do you think they suggest creating an autorelease pool inside your NSXMLParser callback rather than just doing it themselves automatically?

Because they forgot to do it initially, and then when they found that their memory consumption was out of the ballpark wanted to add the pools but couldn't because some client code they didn't want to break was already assuming longer lifetimes than it had any rights to assume.


And yes, the code that I use explicitly runs the runloop, and it is the code that runs the runloop that both allocates the NSURLConnection and then cleans up after it checks the flag. Perfectly safe, perfectly synchronous.

Cheers,

Marcel

_______________________________________________

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: NSXMLParser frees itself on error?
      • From: Jeff Johnson <email@hidden>
References: 
 >NSXMLParser frees itself on error? (From: Mike Manzano <email@hidden>)
 >Re: NSXMLParser frees itself on error? (From: Jesper Storm Bache <email@hidden>)
 >Re: NSXMLParser frees itself on error? (From: "Stephen J. Butler" <email@hidden>)
 >Re: NSXMLParser frees itself on error? (From: Jeff Johnson <email@hidden>)
 >Re: NSXMLParser frees itself on error? (From: Marcel Weiher <email@hidden>)
 >Re: NSXMLParser frees itself on error? (From: Jeff Johnson <email@hidden>)
 >Re: NSXMLParser frees itself on error? (From: Marcel Weiher <email@hidden>)
 >Re: NSXMLParser frees itself on error? (From: Jeff Johnson <email@hidden>)
 >Re: NSXMLParser frees itself on error? (From: Marcel Weiher <email@hidden>)
 >Re: NSXMLParser frees itself on error? (From: Jeff Johnson <email@hidden>)
 >Re: NSXMLParser frees itself on error? (From: Marcel Weiher <email@hidden>)
 >Re: NSXMLParser frees itself on error? (From: Jeff Johnson <email@hidden>)
 >Re: NSXMLParser frees itself on error? (From: Marcel Weiher <email@hidden>)
 >Re: NSXMLParser frees itself on error? (From: Jeff Johnson <email@hidden>)

  • Prev by Date: Re: Garbage collected and non-garbage collected
  • Next by Date: Re: Core Data Migration and the Inexperienced Younger Self
  • Previous by thread: Re: NSXMLParser frees itself on error?
  • Next by thread: Re: NSXMLParser frees itself on error?
  • Index(es):
    • Date
    • Thread