Differences From Artifact [6326631fd1]:
- File src/OFAutoreleasePool.m — part of check-in [5abd9baa33] at 2012-07-16 12:19:59 on branch trunk — Free memory when the last pool has been drained. (user: js, size: 2734) [annotate] [blame] [check-ins using]
To Artifact [6cf9fdd824]:
- File
src/OFAutoreleasePool.m
— part of check-in
[417b213d41]
at
2012-07-16 23:49:50
on branch trunk
— Add OF_ENSURE.
This is to be used when the condition includes a statement that needs to
be executed, as with assert, this would not be executed anymore when
NDEBUG is defined. (user: js, size: 2738) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
14 15 16 17 18 19 20 | * file. */ #include "config.h" #include <stdlib.h> | < < > > > < < | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | * file. */ #include "config.h" #include <stdlib.h> #import "OFAutoreleasePool.h" #import "OFArray.h" #import "OFNotImplementedException.h" #import "macros.h" #ifndef OF_COMPILER_TLS # import "threading.h" # import "OFInitializationFailedException.h" #endif extern id _objc_rootAutorelease(id); extern void* objc_autoreleasePoolPush(void); extern void objc_autoreleasePoolPop(void*); #ifdef OF_COMPILER_TLS static __thread void *first = NULL; #else |
︙ | ︙ | |||
86 87 88 89 90 91 92 | pool = objc_autoreleasePoolPush(); if (first == NULL) #ifdef OF_COMPILER_TLS first = pool; #else | | | 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | pool = objc_autoreleasePoolPush(); if (first == NULL) #ifdef OF_COMPILER_TLS first = pool; #else OF_ENSURE(of_tlskey_set(firstKey, pool)); #endif _objc_rootAutorelease(self); } @catch (id e) { [self release]; @throw e; } |
︙ | ︙ | |||
132 133 134 135 136 137 138 | ignoreRelease = YES; #ifdef OF_COMPILER_TLS if (first == pool) first = NULL; #else if (of_tlskey_get(firstKey) == pool) | | | 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | ignoreRelease = YES; #ifdef OF_COMPILER_TLS if (first == pool) first = NULL; #else if (of_tlskey_get(firstKey) == pool) OF_ENSURE(of_tlskey_set(firstKey, NULL)); #endif objc_autoreleasePoolPop(pool); [super dealloc]; } |
︙ | ︙ |