Nat! bio photo


Senior Mull.

Twitter RSS


GnuSTEP NSAutoreleasePool

Well, I figured a bit late that Gnustep oughta have its own implementation of NSAutoreleasePool, so I am just downloading and see how that works...

Well first of all it's way of adding objects to the pool is actually identical to the way I did.

They also seem to optimize the creation of autorelease pools, by not actually freeing old instances of a thread but keeping them around. Now I don't know... At first I thought that would be superflous, as I rarely ever allocate NSAutoreleasePools. But if you have loops where you create and destroy them often to conserve memory it could be conceivably worth it. I'd bet that this has no measureable effect whatsoever, except in synthetic benchmarks. Which .. makes it worth it :)

Deallocation of pooled objects is implemented naively in GNUstep :).

So I'd expect that the MulleAutoreleasePool would handily beat the GNUstep NSAutoreleasePool when the pool contains many objects.

The NSAutoreleasePools for each thread are stored in the pthread's (actually cthread's) thread dictionary. I have no idea if this is faster or slower than what I did. I used my own local dictionary, indexed by pthread_self. Gotta peek into Darwin for this.