I spent a little time talking to C++ people recently (sorry), and one criticism they had of Objective-C was the lack of a way of allocating objects on the stack. Since then, I have been looking at NSZone a bit, and it occurred to me that we could have something equivalent if we created an NSZone in a global somewhere that didn't free automatically and was only valid for the duration of the run loop.

Like the default NSAutoreleasePool, it would have to be created at the start of each run loop, and destroyed at the end. Any objects put on it that were still valid at the end would (from what I've read) automatically be copied into the default zone when the 'stack zone' was recycled.

This would give us a mechanism for very quickly creating objects that have a very short lifecycle. Is it interesting? If so, is there a way of registering a method or function to be called at the start and end of the run loop, or would it require modification of the run-loop code itself?

_______________________________________________
Etoile-dev mailing list
[email protected]
https://mail.gna.org/listinfo/etoile-dev

Reply via email to