Skip to content

pager: git log under LazyGit spins at 100% CPU and consumes gigabytes #977

Description

@ryanseddon

What happened?

With hunk pager configured as LazyGit's pager, opening a repository with roughly 4,000 commits launches multiple Hunk processes for LazyGit's concurrent branch-log queries. Each process continuously uses approximately 100% of one CPU core and grows to gigabytes of resident memory.

The observed process tree was:

lazygit
├─ git log --graph --color=always --abbrev-commit --decorate --date=relative --pretty=medium <feature-ref> --
│  └─ hunk pager
├─ git log --graph --color=always --abbrev-commit --decorate --date=relative --pretty=medium <default-ref> --
│  └─ hunk pager
└─ git log --graph --color=always --abbrev-commit --decorate --date=relative --pretty=medium <default-ref> --
   └─ hunk pager

After approximately 55 seconds, the three Hunk processes were still running at about 100% CPU each, with RSS values of approximately 2.6 GB, 7.8 GB, and 0.9 GB. macOS sample reported physical-footprint peaks up to 6.5 GB for an individual process.

The complete Git log output is only about 3 MB per branch (approximately 4,000 commits), measured independently with the same git log arguments and --no-pager.

No global Git pager points to Hunk, PAGER=less, and a small standalone diff piped through hunk pager exits normally. The behavior was noticed after updating Hunk to 0.21.0; the previously installed version is unknown.

This may be related to #247's description of hunk pager buffering complete Git log streams, although this reproduction uses a non-patch git log stream and shows extreme amplification from roughly 3 MB of input to gigabytes of memory.

Environment:

Hunk: 0.21.0 (Homebrew)
LazyGit: 0.63.1 (Homebrew, arm64)
Git: 2.55.0
OS: macOS 26.5.1 (25F80), Apple M4 Pro, arm64
Terminal: tmux, TERM=xterm-256color, COLORTERM=truecolor
Shell: zsh

Steps to reproduce

  1. Configure Hunk as LazyGit's pager on macOS:

    git:
      pagers:
        - colorArg: always
          pager: hunk pager
  2. Open LazyGit in a repository with several thousand commits.

  3. Select/navigate branches so LazyGit renders branch history.

  4. Inspect the hunk pager processes in btop, ps, or Activity Monitor.

Observed consistently during the captured reproduction. Removing the Hunk pager configuration avoids the problem.

Expected behavior

Non-diff git log output in LazyGit's captured-pager context should be passed through promptly with bounded CPU and memory usage. Concurrent LazyGit render jobs should terminate rather than leaving Hunk processing indefinitely.

Version

0.21.0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions