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
49.77k stars 3.06k forks source link

Memory Usage at 174GB (Gigabytes)! #6336

Closed cunninghamd closed 11 months ago

cunninghamd commented 1 year ago

Check for existing issues

Describe the bug / provide steps to reproduce it

My mac complained it was entirely out of system memory, which seemed odd. Upon investigating, it turns out Zed was using over 174GB of RAM.

Now, my workflow may not be what you consider ideal, just as an FYI:

So, yeah, there's possibly an awkward memory leak in there somewhere. :)

Environment

Zed: v0.106.2 (stable) OS: macOS 13.6.0 Memory: 32 GiB Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

Screenshot 2023-10-03 at 11 05 49 AM-zed editor

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

mrnugget commented 1 week ago

open a phoenix project, start a server, leave the computer for a few hours and come back.

Just a fresh Phoenix project? Or does it need something else? Is the server started inside Zed in the terminal?

barrelltech commented 1 week ago

TBH I have put in zero time trying to recreate it. The other day was the first time I even put in the time to see if it was a solve-able problem. Again quit+reopen takes <1 second so it hasn't been a huge blocker.

I started using Zed when I decided to make a Phoenix project, so I've been using them exclusively since their mutual day 1. If this issue didn't start happening from day one, it was pretty early on.

I always have three terminal panes open inside of zed: one with lazygit, one with iex -S mix phx.server, and one that is just a terminal shell that I run commands/tests from. These run in the right pane.

I almost always have two files open side by side in the middle. <5 tabs per pane

Left hand side is sometimes the Assistant (although this issue predates me using the assistant).

I never have the file tree open (ever).

I went back one month and retrieved my dependency list (I've added a lot of complexity in the last month, but again, this issue predates those changes):

  defp deps do
    [
      {:bandit, "~> 1.2"},
      {:clerk, "~> 1.0.1"},
      {:cors_plug, "~> 3.0"},
      {:credo, "~> 1.6", only: [:dev, :test], runtime: false},
      {:dialyxir, "~> 1.4", only: [:dev, :test], runtime: false},
      {:dns_cluster, "~> 0.1.1"},
      {:ecto_sql, "~> 3.10"},
      {:esbuild, "~> 0.8", runtime: Mix.env() == :dev},
      {:floki, ">= 0.30.0", only: :test},
      {:gettext, "0.24.0"},
      {:jason, "~> 1.4.4"},
      {:mix_test_watch, "~> 1.0", only: :test, runtime: false},
      {:mox, "~> 1.0", only: [:test]},
      {:oban, "~> 2.18"},
      {:pgvector, "~> 0.2.1"},
      {:phoenix, "~> 1.7.12"},
      {:phoenix_ecto, "~> 4.4"},
      {:phoenix_html, "~> 4.0"},
      {:phoenix_live_dashboard, "~> 0.8.3"},
      {:phoenix_live_reload, "~> 1.2", only: :dev},
      {:phoenix_live_view, "~> 0.20.2"},
      {:poison, "~> 6.0"},
      {:postgrex, ">= 0.0.0"},
      {:req, "~> 0.5.6"},
      {:sentry, "10.7.1"},
      {:tailwind, "~> 0.2", runtime: Mix.env() == :dev},
      {:the_fuzz, "~> 0.5.0"},
      {:telemetry_metrics, "~> 1.0"},
      {:telemetry_poller, "~> 1.0"},
      {:timex, "~> 3.7.11"},
      {:heroicons,
       github: "tailwindlabs/heroicons", tag: "v2.1.1", sparse: "optimized", app: false, compile: false, depth: 1}
    ]
  end

So fairly fresh phoenix project. I don't think it's anything internal in the phoenix app, as my BEAM process never passes a few hundred megabytes