gitui-org / gitui-org/gitui

Lots of memory usage with GBs sized files in diff

Aperta
#1,698 1 commento 3 reazioni 0 assegnatari Vedi su GitHub
bug dormant
Lingua principale
Rust
Stelle
22.5k
Fork
773
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

**Describe the bug**

Opening the app in a repo containing a large uncommitted file has gitui quickly consuming all available memory on my system. I have to quit quickly before my system halts.

**To Reproduce**

1. place a multi GB file in a repo
2. open `gitui`
3. scroll down and select this file
4. (optional) scroll away and select another file, notice that memory usage continues to climb

**Expected behaviour**

It took me a while to notice the issue, as it was taking down my machine before I could play-around, I was assuming it was another cause.

It appears that gitui was trying to present the diff of the new uncommitted file to me. I believe the flame graph below confirms that `git_diff_file_content__init_from_src()`.

Some potential solutions:

1. Perhaps have a limit on the size of file contents we're willing to present to the user in the diff viewer
2. or perhaps only present the file content on-focus of the diff viewer (on the right)

**Screenshots**
![Screenshot from 2023-05-23 08-39-05](https://github.com/extrawurst/gitui/assets/1245553/2d6c9366-fbb1-48c2-b92b-a9d49749d27f)

**Context (please complete the following information):**
- Fedora Linux 38.20230520.0 (Silverblue)
- gitui 0.20.1
- Rust version: 1.69.0

**Additional context**

`make profile` which produced the following flamegraph:

![flamegraph](https://github.com/extrawurst/gitui/assets/1245553/9446ff93-0187-433b-8c02-b3c67e151188)

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia riproducendo il report con un file non sottoposto a commit di diversi GB in gitui, quindi usa il percorso indicato `git_diff_file_content__init_from_src()` e `make profile` per analizzare la crescita della memoria quando si selezionano e si cambiano i file. Il lavoro è completato quando il visualizzatore delle differenze non consuma più memoria in modo illimitato per i file di grandi dimensioni, mentre le normali differenze tra file rimangono utilizzabili.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
git, rust
Ambito
cli, performance
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.