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
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler in itselfSILGenArea → compiler: The SIL generation stage
We've discovered an interesting memory leak when using `try?`. Here's an example to reproduce it:
struct Error: ErrorType {}
func something() throws {
throw Error()
}
for _ in 0..<10000000 {
// Leaks if you use `try?`
_ = try? something()
// Doesn't leak if you handle the error
// do {
// try something()
// } catch {}
}
To see this in action you can compile this with `swiftc` and then execute it through instruments using the leaks tool. We're seeing this in both Swift 2.1 and the most recent 2.2 beta bundled with the Xcode 7.3 beta.
The text was updated successfully, but these errors were encountered:
@belkadan Is it safe to emit a strong release right after the createBBArg?. That emits the right SIL but I'm not sure that's the right way of fixing this. Maybe you can shed some light and I can submit a PR
Martin, that sounds about right. Ideally we would try to use the ManagedValue abstraction instead of emitting a release directly. I'll take a look right now.
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler in itselfSILGenArea → compiler: The SIL generation stage
Additional Detail from JIRA
md5: 569d1a0a8ce41b1db20ee5b587fead55
duplicates:
Issue Description:
We've discovered an interesting memory leak when using `try?`. Here's an example to reproduce it:
To see this in action you can compile this with `swiftc` and then execute it through instruments using the leaks tool. We're seeing this in both Swift 2.1 and the most recent 2.2 beta bundled with the Xcode 7.3 beta.
The text was updated successfully, but these errors were encountered: