jesseduffield / lazygit

simple terminal UI for git commands
MIT License
48.77k stars 1.74k forks source link

crash on searching in commits #3564

Open yimingwangdell opened 2 months ago

yimingwangdell commented 2 months ago

Describe the bug

To Reproduce my project is super big, which has around 140000 commits, when use / to search a keywork in first commit message. it stuck for a while, then crashed.

Expected behavior improve searching speed. then no crash.

Screenshots If applicable, add screenshots to help explain your problem. image

Version info: 0.41.0 2.35.3

Additional context Add any other context about the problem here.

Note: please try updating to the latest version or manually building the latest master to see if the issue still occurs.

yimingwangdell commented 2 months ago

I am not sure if commit number is a problem because it looks only 300 commits are loaded.

stefanhaller commented 2 months ago

This is a known problem. What happens here is that normally lazygit only loads the first 300 commits, that's why it's tolerably fast even in huge repositories; however, when you scroll all the way down to the last of those 300 commits (or press > to get there quickly), lazygit loads all commits, and this currently takes so much memory that it either gets unbearably slow, or even crashes.

And the same happens when you press / to search: this also triggers loading all commits, on the assumption that you may want to search them all.

There has been some work on improving the memory consumption, see #2533. I'm planning on picking up that work again relatively soon, but I can't promise anything.