Differences From Artifact [ed23b75b52]:
- File src/OFAutoreleasePool.h — part of check-in [95db0335d8] at 2012-02-29 21:12:25 on branch 0.6 — \cond internal is not needed anymore. (user: js, size: 2259) [annotate] [blame] [check-ins using] [more...]
To Artifact [d6d789a7b7]:
- File
src/OFAutoreleasePool.h
— part of check-in
[f5927f8a84]
at
2012-07-14 20:00:11
on branch trunk
— New autorelease pools.
This uses the runtime's autorelease pools and implements autorelease
pools in the ObjFW runtime. It therefore uses ObjFW's autorelease pools
when using the ObjFW runtime and Apple's autorelease pools when using
the Apple runtime.These new pools should be ARC-compatible now and finally, it should be
possible to mix OFAutoreleasePools and NSAutoreleasePools again, even
@autoreleasepool is allowed in the mix now. This also means the old
bridge to NSAutoreleasePool should not be required anymore, as both use
the runtime's autorelease pools now.As a bonus, it's significantly faster to use the ObjFW runtime with
ObjFW's autorelease pools than to use Apple's runtime with Apple's
autorelease pools, as a quick benchmark using OFXMLParser on large files
showed. (Note: This is not only due to the different autorelease pools,
but also due to the fact that even with the same autorelease pools it is
faster using the ObjFW runtime, as can be seen in versions prior to this
commit.) (user: js, size: 2201) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
22 23 24 25 26 27 28 | * The OFAutoreleasePool class is a class that keeps track of objects that will * be released when the autorelease pool is released. * * Every thread has its own stack of autorelease pools. */ @interface OFAutoreleasePool: OFObject { | < | < > > | < | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | * The OFAutoreleasePool class is a class that keeps track of objects that will * be released when the autorelease pool is released. * * Every thread has its own stack of autorelease pools. */ @interface OFAutoreleasePool: OFObject { void *pool; BOOL ignoreRelease; } /** * \brief Adds an object to the autorelease pool at the top of the * thread-specific autorelease pool stack. * * \param object The object to add to the autorelease pool * \return The object */ + (id)addObject: (id)object; + (void)_releaseAll; /** * \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 |
︙ | ︙ |