mirror of
https://github.com/gnustep/libs-base.git
synced 2025-06-02 09:31:07 +00:00
avoid buildup of large autorelease pool as suggested by Fred
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@35965 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
04b9c720ba
commit
fc22d6d5be
1 changed files with 4 additions and 1 deletions
|
@ -1823,11 +1823,13 @@ static UCollator *GSICUCollatorOpen(NSStringCompareOptions mask, NSLocale *local
|
||||||
NSRange complete;
|
NSRange complete;
|
||||||
NSRange found;
|
NSRange found;
|
||||||
NSMutableArray *array;
|
NSMutableArray *array;
|
||||||
|
IF_NO_GC(NSAutoreleasePool *pool; NSUInteger count;)
|
||||||
|
|
||||||
if (separator == nil)
|
if (separator == nil)
|
||||||
[NSException raise: NSInvalidArgumentException format: @"separator is nil"];
|
[NSException raise: NSInvalidArgumentException format: @"separator is nil"];
|
||||||
|
|
||||||
array = [NSMutableArray array];
|
array = [NSMutableArray array];
|
||||||
|
IF_NO_GC(pool = [NSAutoreleasePool new]; count = 0;)
|
||||||
search = NSMakeRange (0, [self length]);
|
search = NSMakeRange (0, [self length]);
|
||||||
complete = search;
|
complete = search;
|
||||||
found = [self rangeOfCharacterFromSet: separator];
|
found = [self rangeOfCharacterFromSet: separator];
|
||||||
|
@ -1844,10 +1846,11 @@ static UCollator *GSICUCollatorOpen(NSStringCompareOptions mask, NSLocale *local
|
||||||
found = [self rangeOfCharacterFromSet: separator
|
found = [self rangeOfCharacterFromSet: separator
|
||||||
options: 0
|
options: 0
|
||||||
range: search];
|
range: search];
|
||||||
|
IF_NO_GC(if (0 == count % 200) [pool emptyPool];)
|
||||||
}
|
}
|
||||||
// Add the last search string range
|
// Add the last search string range
|
||||||
[array addObject: [self substringWithRange: search]];
|
[array addObject: [self substringWithRange: search]];
|
||||||
|
IF_NO_GC([pool release];)
|
||||||
// FIXME: Need to make mutable array into non-mutable array?
|
// FIXME: Need to make mutable array into non-mutable array?
|
||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue