You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SR-3536 Memory leak with String.range(options: .regularExpression)
Issue Description:
NSCache's implementation on Linux only works when the keys are statically defined keys, such as globally defined static constants.
open class NSCache ... {
private var _entries = Dictionary<UnsafeRawPointer, NSCacheEntry<KeyType, ObjectType>>()
open func object(forKey key: KeyType) -> ObjectType? {
var object: ObjectType?
let keyRef = unsafeBitCast(key, to: UnsafeRawPointer.self)
_lock.lock()
if let entry = _entries[keyRef] {
object = entry.value
}
_lock.unlock()
return object
}
}
As a result, when using dynamically created keys (such as the result of String interpolation) this implementation fails and results in excessive growth; in addition, it does not seem to respect the countLimit. So any Linux code using NSCache directly or indirectly with non-static keys will experience unconstrained memory growth as items are added.
The text was updated successfully, but these errors were encountered:
Environment
Linux (Ubuntu 14.04), Swift 3.0.2 release
Additional Detail from JIRA
md5: 4082a5d33afc742e7794d6fbe23ca817
cloned from:
Issue Description:
NSCache's implementation on Linux only works when the keys are statically defined keys, such as globally defined static constants.
As a result, when using dynamically created keys (such as the result of String interpolation) this implementation fails and results in excessive growth; in addition, it does not seem to respect the countLimit. So any Linux code using NSCache directly or indirectly with non-static keys will experience unconstrained memory growth as items are added.
The text was updated successfully, but these errors were encountered: