New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SR-919] Memory Leak using "try?" #43531
Comments
Does this happen with optimization? |
Which version of the Swift compiler are you using? (swiftc -v) |
Comment by Anthony Miller (JIRA) @gottesmm: This does seem to still be occurring with or without optimization |
Anthony Miller: Can you put a colon next time when you ask people specific questions. I thought since there was no colon at first that I wrote your comment. Ok. Since it occurs in either case, it could be a frontend bug. |
Comment by Anthony Miller (JIRA) Sorry about that, I've fixed that and added colons. Hope that your team is able to reproduce and solve this issue. Thanks, Anthony. |
@slavapestov fixed this in ebb8d73. |
Comment by Anthony Miller (JIRA) That's great news. Is this fix included in Swift 2.2? |
Unfortunately not, but we're considering it if there's a 2.2.1. Meanwhile your workaround is what you already mentioned: use an explicit do/catch. (And you can write a wrapper function that's nearly equivalent.) |
Environment
Compiler: Apple Swift version 2.1.1 (swiftlang-700.1.101.15 clang-700.1.81)
Target: x86_64-apple-darwin15.3.0
Additional Detail from JIRA
md5: df0612473392fcffe109bd7256c7f2a4
is duplicated by:
try?
Issue Description:
I'm seeing a memory leak of a `_SwiftNativeNSError` whenever I'm using "try?". The error I'm throwing is not an `NSError`, it is a swift enum conforming to `ErrorType`.
Here is some example code.
Changing the code to use "try" with a "catch" block gets rid of the leaks in Instruments.
The text was updated successfully, but these errors were encountered: