Re: Newbie with stupid question cont.
Re: Newbie with stupid question cont.
- Subject: Re: Newbie with stupid question cont.
- From: Shawn Erickson <email@hidden>
- Date: Tue, 19 Mar 2002 18:47:05 -0800
On Tuesday, March 19, 2002, at 08:52 AM, Shawn Erickson wrote:
On Tuesday, March 19, 2002, at 07:42 AM, Don Rainwater wrote:
Seems counter-intuitive, doesn't it? You would think that the
overhead involved in this approach would be expensive. Is this a
memory allocation issue? Is it because the default pool is of a
preset size and extending it incurs a lot of overhead, or because of
overall process resource allocations, or...? For a really high loop
count, would there be any benefit to something like:
NSAutoreleasePool *pool;
pool = [[NSAutoreleasePool alloc] init];
for (x = 1; x <= highLoopLimit; x++) {
if (!(x % poolLimit)) {
[pool release];
pool = [[NSAutoreleasePool alloc] init];
}
...
}
[pool release];
// where poolLimit is 100, or 1000, or some useful number less
than highLoopLimit.
Or am I overthinking this?
AFAIK autorelease pools use a simple linked list of objects. So I don't
think you need worry hitting a limit and incurring a reallocation of
the autorelease pool collection storage.
Light goes on! I am sorry misunderstood your question.
Yes doing as you outlined reduces the overhead of creating and
destroying an autorelease pool at the cost of increased memory usage.
The trick is finding the sensible balance for your application.
-Shawn
_______________________________________________
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.