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
Swift language leaks memory when having constant on constraints. #225
Comments
@soapsign thanks for the report, I'll have a look later tonight. |
have the same problem, run instrument leak |
Memory leak. Me too |
@googlb @cherishloveyou @soapsign can any of you post the instruments trace showing the leak? I see a leak but it's not from SnapKit, rather it appears to be from Swift itself. |
@robertjpayne I am having the same issue, here's what I could get from Instruments so far. In the first |
@NickSkull do you have the full instrument screenshot on that? It doesn't reveal much about what is leaking vs what's an allocation/call stack. Also does it happen in |
@robertjpayne What exactly should I take a screenshot of? AFAIK There wasn't really anything relevant in allocations. When looking into code, Instruments show all these Haven't tried in |
@NickSkull it looks like you've screenshotted the As far as I can tell from your screenshot the leaks are occurring but not because of SnapKit but rather lower level libraries. |
Digging a bit deeper it looks entirely related around |
@robertjpayne Oh, I forgot to mention that - I don't think it's (entirely) SnapKit's fault, rather a Swift issue, but there usually is a workaround that makes the leaks go away. :D Screenshot attached, I didn't attach it before, because there's IMO no value/clue in it. |
Just a guess. Will it be related to |
@soapsign I tried switching to |
Yea I'm not really sure how far to dig on fixing this, it's probably something we're going to have to wait until Swift 3.0 or something. |
I've renamed the issue, I don't want people to get scared that SnapKit is a memory sieve but I also don't want to close this. I'm happy to merge any PR's that resolve this I just personally don't have enough time at the moment to try and work around Swift in this instance. |
@robertjpayne Thanks for the info. I will also have a look at SnapKit 0.30.0 (if it can be compiled and run) and see if the issue is occurring there. |
At the moment I think 0.30.0 is close but not quite ready to replace 0.20.0, I need to find a spare weekend to finish it up 👍 |
@robertjpayne Just verified that 0.30.0 fixes the leak as far as I can see. Tested in multiple places and no leaks occurred anymore. |
@NickSkull interesting, I'll see what I'm doing differently in 0.30.0 to get the constant values and see if I can backport it. Saw your comment about a checklist, honestly I need to evaluate the codebase again to confirm what's left! |
@robertjpayne I think it can have something to do with the |
I just pushed 0.30.0.beta1 to Cocoapods, it actually should be quite stable though do expect a bug here or there potentially and the API has changed a bit. |
Does anyone know if this is resolved in Swift 2.3? I know it's fixed in Swift 3.0… |
Closing this as it's invalid now I believe, with the advent of Swift 2.3/3.0 we should see this pretty much fade away in due time. |
I am also having the same issue at Swift3.1. |
New Issue Checklist
Issue Info
Issue Description
The above lines of code will cause memory leak. You can examine the leak by using instrument leak tool.
The text was updated successfully, but these errors were encountered: