On Apr 16, 2012, at 8:10 PM, Graham Cox <graham....@bigpond.com> wrote:

> Memory management is really quite straightforward, and consists of a few 
> rules that everything follows (the framework invariably does; your code 
> should do).


If that were true, then ARC would not have been necessary.

> On 16/04/2012, at 7:42 PM, Patrick Robertson wrote:
> 

>> so are these temp objects created during the enumeration released
>> automatically at the end of the loop, or is it work wrapping the whole
>> thing in an autoreleasepool?

No implicit pools are created.

When it comes to autorelease pools, we primarily see them as a performance 
tuning technique. If your code is not running into performance problems and if 
the documentation does not explicitly tell your code to use a pool (say for use 
with NSThread), then please don't worry about it.

And if you are running into performance problems on a per iteration basis, then 
please remember that the rules of C allow you to write code like this to avoid 
double indenting:

for (id anObject in anArray) @autoreleasepool {
    // do stuff
}

do @autoreleasepool {
    // do stuff
} while (x);

while (x) @autoreleasepool {
    // do stuff
}



davez
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to