NSBlog
"A failure in the hot air department"
Showing entries tagged "autorelease". Full blog index.
Friday Q&A 2011-09-02: Let's Build NSAutoreleasePool
at 2011-09-02 16:30
It's that time again: time for more programming craziness. Dallas Brown suggested that I talk about how
NSAutoreleasePool
works behind the scenes. I decided that the best way to do that would be to simply reimplement it, and that is what I'll discuss today.More Fun With Autorelease at 2007-02-08 00:00
I just hit a subtle but commonly known bug for the first time. I thought I'd share my fun with the world.
Everybody reading this blog should know about autorelease pools and how they work in Cocoa. As everybody knows, every time you go through the event loop, Cocoa blows away the old pool and makes a new one for you, so that all of your autoreleased objects go away and your new ones go into a fresh pool. That way you never build up more objects than get produced during a single event loop cycle.
Autorelease is Fast at 2006-06-07 00:00
If you've done much Cocoa programming, you've probably run into a situation where you needed to create a local autorelease pool because of some sort of loop. And you've probably run into advice telling you not to create and destroy the pool for every iteration, because that would be slow. I never believed that it could be significant, and I finally took the time to test it today. What's the verdict? Just as I thought, making autorelease pools is really fast.