On Mon, Jan 12, 2009 at 2:53 PM, Robert Marini <[email protected]> wrote:
> Autoreleased objects have the trigger of a release delayed until the > autorelease pool is "drained." ... which may or may not be at the end of the current run loop. There are a lot of "ifs" to consider, which are explained in the documentation. > ... and, really, is there a good reason to > keep things in memory longer than they need to be? Sure! What about batch-processing 10,000,000 items? :-) On the one hand, creating all 10,000,000 items and leaving them in memory is likely to kill something most efficiently, but on the other, calling -release on each item when they're done may* be costlier than batch-releasing them by implicitly draining the pool every 1000, or 500, or 10, or so. * I say 'may' because this isn't necessarily the case, but is most likely for any but the most trivial applications / data models. Consider creating 10,000,000 objects, each one of which references about twenty other objects, or contains a large blob of binary data (like an image). Overall, this question is difficult to ask because it's pretty general. The real answer is: it depends entirely on the situation. Implement it, performance test it, than adjust it if necessary. -- I.S. _______________________________________________ Cocoa-dev mailing list ([email protected]) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
