zed
zed copied to clipboard
Zed memory usage greater than vscode and memory leak issue on long run
Check for existing issues
- [X] Completed
Describe the bug / provide steps to reproduce it
Zed using more memory than vscode. VSCode - 127MB for big angular project Zed - 220MB for basic HTML and ts file project
I left zed and vscode over the night and in the morning i see that zed memory consumption is more (350MB).
I think there is a memory leak in Zed and also Why it is consuming more memory than VSCode.
Environment
Zed: v0.123.1 (Zed Preview) OS: macOS 14.2.1 Memory: 16 GiB Architecture: aarch64
If applicable, add mockups / screenshots to help explain present your vision of the feature
If applicable, attach your ~/Library/Logs/Zed/Zed.log
file to this issue.
If you only need the most recent lines, you can run the zed: open log
command palette action to see the last 1000.
No response
I also think there is a memory leak somewhere. When I freshly start a pretty large ts project Zed consumes ~280MB, but sometime after a day of work it's over 4GB.
Leak could be caused by the same issue as https://github.com/zed-industries/zed/issues/7438 More contribution to the memory bloat might be caused by the way we store LSP logs: they are capped but maybe not enough, see https://github.com/zed-industries/zed/pull/3134 for more context
https://github.com/typescript-language-server/typescript-language-server/issues/472#issuecomment-1193381252 is also something that makes VSCode consume less memory with tsserver
compared to a standalone typescript-language-server
Ive been dealing with the same thing. Im primarily working on a Rust project with a couple files with a few thousand lines of code each. When I open Zed it uses 200-300 MB of memory but after not that long period of time, sometimes as short as an hour or two, it will be anywhere between 4GB too 8GB. I end up killing it and reopening after I get the rainbow wheel of death, and then I go for another couple of hours. I would obviously perfer not to do this but it isnt a deal breaker as I really like the editor. It is something the Zed team should definitly fix and quickly.
Maybe some circular reference that is not properly handled with a Weak reference?
I've left some instructions on how to capture memory profiles here: https://github.com/zed-industries/zed/issues/8436#issuecomment-2003220816
If someone wants to take a stab at that, that'd be nice. Otherwise it'd be great to have an example project that we can use to reproduce.