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-9982] Memory leak when casting Array of AnyObjects ([AnyObject]) to [AnyHashable] #52386
Comments
@Catfish-Man, @mikeash, does this sound familiar? carboncomputed (JIRA User), what version of Swift are you using? |
Can't say it rings a bell, no |
Sounds similar to the bug I fixed in #20836. Probably the same sort of ownership mismatch in the casting code. |
Comment by Kevin Carbone (JIRA) @belkadan I'm using Swift 4.2. Note this also occurs for me if I try to iterate through values (compactMap, for loop, etc) and try to cast on the initial values. |
Can you check with the Xcode 10.2 beta (or other 5.0 of your choice) and see if it happens there? Could be that it actually is that problem I fixed above. If it's still present, can you see if a single AnyObject -> AnyHashable cast also leaks? If the array is superfluous that would help narrow it down. |
Comment by Kevin Carbone (JIRA) @mikeash I've confirmed that I no longer see this leak on Swift 5. It looks to be fixed by your patch! Awesome. Are there any limitations to releasing my app packaged with Swift 5 even though its Beta? (Apple rejection, etc)? |
Glad to hear it! I don't think it's recommended to distribute an app built with a beta Xcode. Obviously, non-beta releases are not exactly guaranteed to be bug-free either, but it's best to wait if you can. |
Additional Detail from JIRA
md5: 8aa68f4906fb7f595745de90e6eea168
Issue Description:
https://pastebin.com/xaQ94TWb
The cast succeeds but deinit is never called and our objects are never deallocated. This also happens if I compactMap through the array and try to add each one individually.
The text was updated successfully, but these errors were encountered: