Re: Newbie with stupid question cont.
Re: Newbie with stupid question cont.
- Subject: Re: Newbie with stupid question cont.
- From: Ondra Cada <email@hidden>
- Date: Tue, 19 Mar 2002 14:13:58 +0100
On Tuesday, March 19, 2002, at 07:44 , Sam Goldman wrote:
for(x=0 ; x < [ifaces count]; x++){
sReturn = [NSString stringWithFormat:@"%@ (%@)", [ifaces
objectAtIndex:x], [self getIPForInterface:[ifaces objectAtIndex:x]]];
[arrReturn addObject:sReturn];
[sReturn release]
}
And you probably don't want to have a bunch of autoreleased objects in a
loop. The autorelease pool will get really big and slow down your app. If
performance is an issue, then you should avoid autoreleased objects being
created inside of loops which count potentially happen a bunch of times.
Nope. quite the contrary. With a vast majority of loops (depends on other
conditions too, but a rough guess might be up to XXX iterations)
autoreleasing makes no problem at all, and the slowing down is
unnoticeable.
If the loop is to be iterated many times indeed, the solution is still
autoreleasing, this time with a local loop:
for (...many times...) {
NSAutoreleasePool *pool=[[NSAutoreleasePool alloc] init];
...
[pool release];
}
---
Ondra Cada
OCSoftware: email@hidden
http://www.ocs.cz
2K Development: email@hidden
http://www.2kdevelopment.cz
private email@hidden
http://www.ocs.cz/oc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.