Re: Some really simple release/autoRlease questions
Re: Some really simple release/autoRlease questions
- Subject: Re: Some really simple release/autoRlease questions
- From: Krevnik <email@hidden>
- Date: Sat, 15 Mar 2003 15:25:50 -0800
But this is bad advice, IMHO. Autoreleasing an object is _by
definition_ more expensive than directly releasing it, because you
have the overhead of adding a pointer to the object to the autorelease
pool's list, and iterating over the list when the pool is freed, as
well as the actual release itself.
This is true, although I was giving it based upon his needs are. If
immediate RAM is an issue, then releasing while looping is just fine...
although loops that need to remain tight should not be allocating or
releasing during the loop itself. I think the best solution for
speed/memory if he needs both is to use John's suggestion of re-using
an object. Depending on the data being looped, this may be a good
compromise.
It doesn't matter whether that release happens in your tight loop, or
in AppKit's runloop. Either way, those cycles are taken before your
application can accept another event from the user. From the user's
point of view, it is all happening at the same time.
This is correct from a UI standpoint... and you should bear with me as
I am still getting used to UI-oriented code from writing a lot of tight
C game/math code.
_______________________________________________
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.