Skip to content

Commit f9c0049

Browse files
committed
Update comments
1 parent f691657 commit f9c0049

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

stdlib/public/stubs/SwiftNativeNSXXXBaseARC.m

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,19 @@
2222
// The following two routines need to be implemented in ARC because
2323
// decomposedStringWithCanonicalMapping returns its result autoreleased. And we
2424
// want ARC to insert 'objc_retainAutoreleasedReturnValue' and the necessary
25-
// markers for the hand-off.
25+
// markers for the hand-off to facilitate the remove from autorelease pool
26+
// optimization such that the object is not handed into the current autorelease
27+
// pool which might be scoped such that repeatedly placing objects into it
28+
// results in unbounded memory growth.
2629

27-
// On i386 we use an autorelease pool to prevent leaking.
30+
// On i386 the remove from autorelease pool optimization is foiled by the
31+
// decomposedStringWithCanonicalMapping implementation. Instead, we use a local
32+
// autorelease pool to prevent leaking of the temporary object into the callers
33+
// autorelease pool.
2834
#if defined(__i386__)
2935
#define AUTORELEASEPOOL @autoreleasepool
3036
#else
31-
// On other platforms we rely on autorelease return optimization.
37+
// On other platforms we rely on the remove from autorelease pool optimization.
3238
#define AUTORELEASEPOOL
3339
#endif
3440

0 commit comments

Comments
 (0)