Description
Swift version
swift-6.1.1-RELEASE
Platform
Fedora Linux 40
Editor
Visual Studio Code with Swift Extension 2.4.0, Zed 0.191.1 with Swift Extension 0.4.1
Description
When working in Swift using VSCode or Zed (with the respective extensions installed) sourcekit-lsp is heavily leaking memory. I can reproduce this with different projects and with both mentioned IDEs, so it shouldn't be related to a specific project I am working one. The rate at which memory is leaked depends on how much we engage with sourcekit-lsp, i.e. navigating in a code base using jump-to-definition will leak hundreds of megabytes within some minutes.
I am currently using swift-6.1.1 via swiftly, but I am pretty sure I already observed this when using swift-6.0 via fedora-packages. When I posted my original observation in swiftlang/sourcekit-lsp#1541 (comment) I was using swift-6.1.0 via swiftly.
If helpful, I can share heaptrack traces privately via email.
Steps to Reproduce
No response
Logging
> sourcekit-lsp diagnose
sourcekit-lsp diagnose collects information that helps the developers of sourcekit-lsp diagnose and fix issues.
This information contains:
- Crash logs from SourceKit
- Log messages emitted by SourceKit
- Versions of Swift installed on your system
- If possible, a minimized project that caused SourceKit to crash
- If possible, a minimized project that caused the Swift compiler to crash
All information is collected locally.
Diagnosing sourcekit-lsp issues
10% [==========================----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------]
Determining Swift version of /home/terraputix/.local/share/swiftly/toolchains/6.1.1/usr/bin
💣 Program crashed: Illegal instruction at 0x00007eff0696073e
Thread 5 crashed:
0 0x00007eff0696073e _dispatch_assert_queue_fail + 78 in libdispatch.so
1 specialized Process.readOutput(onFD:outputClosure:) + 350 in sourcekit-lsp at /home/build-user/swift-tools-support-core/Sources/TSCBasic/Process/Process.swift:966:21
2 closure swiftlang/sourcekit-lsp#5 in Process.launch() + 147 in sourcekit-lsp at /home/build-user/swift-tools-support-core/Sources/TSCBasic/Process/Process.swift:779:47
3 0x0000562bdda5e407 partial apply for closure swiftlang/sourcekit-lsp#5 in Process.launch() + 54 in sourcekit-lsp
4 closure swiftlang/sourcekit-lsp#1 in Thread.init(task:) + 183 in sourcekit-lsp at /home/build-user/swift-tools-support-core/Sources/TSCBasic/Thread.swift:50:17
5 0x00007eff06560b86 Thread.main() + 21 in libFoundation.so
Backtrace took 13.09s