Index: src/OFAutoreleasePool.m ================================================================== --- src/OFAutoreleasePool.m +++ src/OFAutoreleasePool.m @@ -88,13 +88,11 @@ if (first == NULL) #ifdef OF_COMPILER_TLS first = pool; #else - if (!of_tlskey_set(firstKey, pool)) - @throw [OFInitializationFailedException - exceptionWithClass: [self class]]; + assert(of_tlskey_set(firstKey, pool)); #endif _objc_rootAutorelease(self); } @catch (id e) { [self release]; Index: src/runtime/autorelease.m ================================================================== --- src/runtime/autorelease.m +++ src/runtime/autorelease.m @@ -74,14 +74,21 @@ id *iter; for (iter = pool; iter < top; iter++) [*iter release]; -#ifdef OF_COMPILER_TLS top = pool; -#else - if (!of_tlskey_set(topKey, pool)) + + if (top == objects) { + free(objects); + + objects = NULL; + top = NULL; + } + +#ifndef OF_COMPILER_TLS + if (!of_tlskey_set(objectsKey, objects) ||!of_tlskey_set(topKey, top)) ERROR("Failed to set TLS key!") #endif } id