Skip to content
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-11287] memory leak in code completion #417

Closed
marcrasi mannequin opened this issue Aug 10, 2019 · 8 comments
Closed

[SR-11287] memory leak in code completion #417

marcrasi mannequin opened this issue Aug 10, 2019 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@marcrasi
Copy link
Mannequin

marcrasi mannequin commented Aug 10, 2019

Previous ID SR-11287
Radar None
Original Reporter @marcrasi
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Source Tooling, SwiftSyntax
Labels Bug
Assignee @rintaro
Priority Medium

md5: c6d1c2bd64fda68f9aeb152794a9724e

Issue Description:

On Ubuntu 18.04, at commit c43eb9b (~noon Aug 9 HEAD), I'm getting memory leaks when doing code completion. To reproduce,

  1. swift/utils/build-script --release --enable-lsan --debug-swift-stdlib

  2. llvm/utils/lit/lit.py build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-linux-x86_64/test-linux-x86_64/IDE/complete_repl_identifier_prefix_1.swift -a

LSAN should print out leaks. Here's what I get: https://gist.github.com/marcrasi/7d1f5e5766833c605b92873687eb49ca

This does not occur at commit 482d062 and does occur at commit 1a211e6, so I suspect that apple/swift#26403 caused it.

@marcrasi
Copy link
Mannequin Author

marcrasi mannequin commented Aug 10, 2019

Interestingly, a lot of the other completion tests (`test/IDE/complete_*`) have leaks detected by LSAN even at commit 482d062. So maybe there were already some completion-related leaks, and then PR26403 added even more?

@marcrasi
Copy link
Mannequin Author

marcrasi mannequin commented Aug 14, 2019

@rintaro have you made any progress on this? It's currently blocking some work on a Google-internal SourceKit deployment that I'm working on. Would it maybe be possible to roll back the PR?

@rintaro
Copy link
Mannequin

rintaro mannequin commented Aug 15, 2019

@marcrasi Sorry for being late.
apple/swift#26664 fixes leak in IDE/complete_repl_identifier_prefix_1.swift which is introduced by apple/swift#26403

Interestingly, a lot of the other completion tests (`test/IDE/complete_*`) have leaks detected by LSAN even at commit 482d062. So maybe there were already some completion-related leaks, and then PR26403 added even more?

Right. I'm still fixing existing leaks.

@marcrasi
Copy link
Mannequin Author

marcrasi mannequin commented Aug 15, 2019

Awesome, I just verified that apple/swift#26664 fixes the issue in the Google-internal SourceKit too! Thanks 🙂

@marcrasi
Copy link
Mannequin Author

marcrasi mannequin commented Aug 15, 2019

Do you think it would be possible to configure the LSAN CI job to run some SourceKit completion tests, to catch regressions earlier? Looks like that job currently doesn't run any tests (https://github.com/apple/swift/blob/1afd0f7cf757ba6b12d2af0d151eafb022acf439/utils/build-presets.ini#L1084), I guess because a lot of them leak so the job would just fail. Maybe we could configure it to run a whitelisted subset of tests under LSAN and slowly whitelist more tests as more leaks get fixed.

I'd be happy to look into this if you think it's a good idea.

@rintaro
Copy link
Mannequin

rintaro mannequin commented Aug 15, 2019

I think that's great idea. Could you file another JIRA issue for that?
CC: @shahmishal

@marcrasi
Copy link
Mannequin Author

marcrasi mannequin commented Aug 15, 2019

@rintaro
Copy link
Mannequin

rintaro mannequin commented Aug 15, 2019

Merged apple/swift#26664

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 9, 2022
adevress pushed a commit to adevress/swift-syntax that referenced this issue Jan 14, 2024
Improve `XCTest` import detection logic.
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

0 participants