[swift-corelibs-dev] Memory leak with String.range(options: .regularExpression) [SR-3536]

Alex Blewitt alblue at apple.com
Wed Feb 8 12:10:55 CST 2017

On 8 Feb 2017, at 16:59, Alex Blewitt via swift-corelibs-dev <swift-corelibs-dev at swift.org> wrote:
> There's a 'cache.countLimit = 10' set on the cache:
> https://github.com/apple/swift-corelibs-foundation/blob/16657160c2c441a58ea01bf7baa90607a0b395f7/Foundation/NSString.swift#L109 <https://github.com/apple/swift-corelibs-foundation/blob/16657160c2c441a58ea01bf7baa90607a0b395f7/Foundation/NSString.swift#L109>
> Shouldn't it start discarding some of the previous entries after it hits the first 10?

Doesn't look like it removes any entries from the cache, nor does the cache work when a String is used as a key. Added info to https://bugs.swift.org/browse/SR-3536 <https://bugs.swift.org/browse/SR-3536>

 > c.setObject("foo",forKey:"foo")
 > c.object(forKey:"foo")
$R6: Foundation.NSString? = nil


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-corelibs-dev/attachments/20170208/05407515/attachment.html>

More information about the swift-corelibs-dev mailing list