jesseduffield / lazygit

simple terminal UI for git commands
MIT License
53.12k stars 1.85k forks source link

Memory climbed to 9.6GB while laptop closed #2460

Open Xevion opened 1 year ago

Xevion commented 1 year ago

Describe the bug My memory usage climbed to 9GB while my laptop was closed. See screenshot. This issue has never occurred before, but I am not a user very often.

To Reproduce Precise steps unknown.

  1. I started lazygit as normal and performed some amend & reword message commands.
  2. I closed my laptop's lid and left the range of WiFi. The battery was high enough such that the OS maintained state.
  3. I reopened my laptop with lazygit at 9.6GB, slowing my entire system down.

Expected behavior lazygit usually operates at around 20MB idle, around 500X less memory than what was being used just now.

Screenshots

I do not know the difference between the two chosen processes, but the 9.6GB process closed and went away as soon as I pressed q in the terminal. The application was still responsive, it seems.

Version info: commit=d1a8b05401ccda1e52215203139a252eb3be3b79, build date=2022-11-14T09:22:31Z, build source=binaryRelease, version=0.36.0, os=windows, arch=amd64, git version=2.35.1.windows.2 git version 2.35.1.windows.2

Additional context

The only idea I have is that lazygit was somehow making network requests (git fetch) in the background, and they were failing continuously or not being made properly. I left the area I was in, thus disconnecting from WiFi. My laptop should not reconnect to WiFi until it is opened, I would believe.

I know this isn't a great bug report, no logs afaik to go off, but I'm curious if you've had any similar reports.

mark2185 commented 1 year ago

Could you post your config.yml?

lazygit does auto fetching by default so it might be because of that.

Xevion commented 1 year ago

While I have since switched to Pop! OS on my laptop, I have access to the original SSD, and the config.yml I found contains nothing. 0 bytes. Last modified December 12th, 2022 (long before I made the report).

mark2185 commented 1 year ago

Well then it could be that the autofetching went wild.

Has it happenned again after that one time?

Xevion commented 1 year ago

I haven't used lazygit a whole lot since, but no.

wesleywerner commented 1 year ago

I tried lazygit today, I left it in an open terminal and went to have dinner. An hour later I came back and the process was exhibiting high CPU usage and memory consumption.

OS: Windows 10 Version 10.0.19045 Build 19045 Terminal used: Windows Terminal Version: 1.16.10261.0

My config.yml:

git:
  paging:
    colorArg: always
    pager: delta --dark --paging=never

0407 Fri 182837

mark2185 commented 1 year ago

Is that the current master? Is the repo a public one?

Could you also please post the logs?

wesleywerner commented 1 year ago

Apologies for leaving out those pertinent details @mark2185

lazygit -v
commit=16802a048e0425182f08cf0e9a2bc31480e9a55d, build date=2023-02-01T11:02:43Z, build source=binaryRelease, version=0.37.0, os=windows, arch=amd64, git version=2.38.1.windows.1

This was on a local repo for a very small personal project (4 files totaling 32k in size), not public, with a total of 17 commits.

I will use the --debug and --log options next time and provide them if this occurs again.

wesleywerner commented 1 year ago

I managed to capture logs this time. I started lazygit and did not issue any commands, it just sat in the background. About 50 minutes later my CPU usage spiked and I captured the log. I exited lazygit with the q key and the process ended normally.

0410 Mon 102447

OS: Windows 10 Version 10.0.19045 Build 19045
Terminal used: Windows Terminal Version: 1.16.10261.0

lazygit -v
commit=16802a048e0425182f08cf0e9a2bc31480e9a55d, build date=2023-02-01T11:02:43Z, build source=binaryRelease, version=0.37.0, os=windows, arch=amd64, git version=2.38.1.windows.1

My config:

git:
  paging:
    colorArg: always
    pager: delta --dark --paging=never

I have now cleared my config file and will keep monitoring.

development.log

wesleywerner commented 1 year ago

I just wanted to provide a quick update on this issue.

After my last comment in April, I upgraded to version 0.39.4 in July, and have been using and monitoring lazygit. I have not been able to reproduce this problem again.

I even re-enabled auto-fetch after a few weeks of testing, and am happily leaving lazygit running in the background without any memory usage spikes.

rRobis commented 5 months ago

Leaking again in v0.42 version. My lazygit got up to 9GB RAM usage.

The latest version that doesn't have this is 0.39.4

zealer-core commented 2 months ago

I have the same issue. I'm on a very large repo and lazy git just freeze use all the memory I have

Screenshot 2024-08-28 at 1 42 24 PM
kryshac commented 2 months ago

image

something is wrong when commits are in full size window and you want to search something

kuleshov-aleksei commented 1 month ago

Also got a memory leak. Opened 2 long-running instances of lazygit and left them untouched for a while. Noticed that the whole RAM was taken by lazygit:

perfmon_MFdaSlzjIi dwm_7CF6nCCzGN image

lazygit --version:

commit=611fabde11d24d9acc71ee26077b9a1101f59f27, build date=2024-09-18T10:56:10Z, build source=binaryRelease, version=0.44.1, os=windows, arch=amd64, git version=2.42.0.windows.2

git --version:

git version 2.42.0.windows.2

config.yml is empty