Overview
Comment: | Make it impossible to add objects to arbitrary autorelease pools.
This is almost never done, and was made impossible in ARC-compatible |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
2e484248de1c25a67ef60130e1cb8cf9 |
User & Date: | js on 2011-09-22 12:09:34 |
Other Links: | manifest | tags |
Context
2011-09-22
| ||
23:25 | Exceptions are now autoreleased. check-in: e1e7ffa903 user: js tags: trunk | |
12:09 | Make it impossible to add objects to arbitrary autorelease pools. check-in: 2e484248de user: js tags: trunk | |
03:10 | Don't use EV_RECEIPT. check-in: 1edb3cb8c7 user: js tags: trunk | |
Changes
Modified src/OFAutoreleasePool.h from [0009cc3f48] to [55b2b70b8b].
︙ | ︙ | |||
36 37 38 39 40 41 42 | * thread-specific autorelease pool stack. * * \param object The object to add to the autorelease pool */ + (void)addObject: (id)object; /// \cond internal | | > < < < < < < < | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | * thread-specific autorelease pool stack. * * \param object The object to add to the autorelease pool */ + (void)addObject: (id)object; /// \cond internal + (void)_releaseAll; - (void)_addObject: (id)object; /// \endcond /** * \brief Releases all objects in the autorelease pool. * * This does not free the memory allocated to store pointers to the objects in * the pool, so reusing the pool does not allocate any memory until the previous * number of objects is exceeded. It behaves this way to optimize loops that * always work with the same or similar number of objects and call relaseObjects |
︙ | ︙ |
Modified src/OFAutoreleasePool.m from [5a81eccbfb] to [74a7fa7b2d].
︙ | ︙ | |||
66 67 68 69 70 71 72 | if (lastPool == nil) { [object release]; @throw [OFInitializationFailedException newWithClass: self]; } @try { | | | | 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | if (lastPool == nil) { [object release]; @throw [OFInitializationFailedException newWithClass: self]; } @try { [lastPool _addObject: object]; } @catch (id e) { [object release]; @throw e; } } + (void)_releaseAll { #ifdef OF_THREADS [of_tlskey_get(firstKey) release]; #else [firstPool release]; #endif } |
︙ | ︙ | |||
125 126 127 128 129 130 131 | [self release]; @throw e; } return self; } | | | 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | [self release]; @throw e; } return self; } - (void)_addObject: (id)object { if (count + 1 > size) { objects = [self resizeMemory: objects toNItems: size + GROW_SIZE ofSize: sizeof(id)]; size += GROW_SIZE; } |
︙ | ︙ |
Modified src/OFThread.m from [a10047f5e7] to [b865223801].
︙ | ︙ | |||
83 84 85 86 87 88 89 | #endif [thread handleTermination]; thread->running = OF_THREAD_WAITING_FOR_JOIN; [OFTLSKey callAllDestructors]; | | | 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | #endif [thread handleTermination]; thread->running = OF_THREAD_WAITING_FOR_JOIN; [OFTLSKey callAllDestructors]; [OFAutoreleasePool _releaseAll]; [thread release]; #if defined(OF_GNU_RUNTIME) || defined(OF_OLD_GNU_RUNTIME) objc_thread_remove(); #endif |
︙ | ︙ | |||
218 219 220 221 222 223 224 | [thread handleTermination]; thread->running = OF_THREAD_WAITING_FOR_JOIN; } [OFTLSKey callAllDestructors]; | | | 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 | [thread handleTermination]; thread->running = OF_THREAD_WAITING_FOR_JOIN; } [OFTLSKey callAllDestructors]; [OFAutoreleasePool _releaseAll]; [thread release]; #if defined(OF_GNU_RUNTIME) || defined(OF_OLD_GNU_RUNTIME) objc_thread_remove(); #endif |
︙ | ︙ |