zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
47.89k stars 2.81k forks source link

serious memory leak issue on windows10 #12561

Open shenjackyuanjie opened 4 months ago

shenjackyuanjie commented 4 months ago

Check for existing issues

Describe the bug / provide steps to reproduce it

as we all know, ( #8436 #7939 zed have some tiny memory leak(?) issue since sometimes ago some how, it will only increase the memory usage for about 1mb/min ( on my windows 10 )

but at some times the memory leak issue became FAST

Environment

Zed: v0.139.0 (Zed Dev 29b5253a1d67dc4582f5713cfa06fc5416b07ab6) OS: Windows 10.0.19045 Memory: 95.9 GiB Architecture: x86_64

image

image

image

apricotbucket28 commented 4 months ago

but after the commit 94c3101, the memory leak issue became FAST

That commit didn't change anything on Windows or macOS. It only affects Linux code.

If you want to help track down the memory leak, use a tool like the Visual Studio memory profiler and post the memory dump here.

skejeton commented 3 months ago

After a session of debugging and tracing, it seems like the issue is not in zed itself, but in blade_graphics implementation of the Vulkan backend. reset_descriptor_pool resets all the sub_pools, however, when we allocate a new descriptor via alloate_descriptor_set, it only uses the latest pool, it doesn't actually reuse the previous pools.

skejeton commented 3 months ago

I confirm the issue is in blade_graphics, and specifically, Intel HD graphics driver, not zed. https://github.com/kvark/blade/issues/117

shenjackyuanjie commented 3 months ago

I confirm the issue is in blade_graphics, and specifically, Intel HD graphics driver, not zed. kvark/blade#117

hmmmm, so there's the problem, my gpu are AMD RX580, so it's possible not just an intel only issue, or it's anther issue

xgfone commented 3 months ago

FYI screenshot-20240612-104247

heksesang commented 3 months ago

So the issue with Intel HD Graphics is solved in https://github.com/kvark/blade/commit/845cdadbfe78b07a3f2b53af105cb497263b9cc4, but the zed master branch is still on an older commit it seems.

aramrw commented 2 months ago

I am having the same problem.

Zed.log seems to be looping over a git error infinitely for as long as the program is running:

2024-07-06T12:05:50-07:00 [ERROR] Error 
{ code: -9, klass: 4, message: "reference 'refs/heads/master' not found" } x500

This is a git error, however the constant error loop is causing a memory leak if I open a project with no git open, zed doesn't leak memory.

Environment

Zed: v0.144.0 OS: Windows 11 Home 10.0.22631 Build 22631 Memory: 32 Gib Architecture: x64-based PC Gpu: Nvidia Rtx 4090 Cpu: Amd 7800x3d