Skip to content

Huge peak memory usage #1673

@ianling

Description

@ianling

Bug Description

PlainClone uses an enormous amount of memory, consuming many times more RAM than a given repo even takes up on disk.

For a large Git repo (private, but can be easily replicated by cloning a public git repo like https://github.com/facebook/react/) that takes up 750MB on disk, go-git consumes nearly 3GB of RAM PlainClone.

go-git Version

HEAD of main 3c570d2

Steps to Reproduce

tmpDir, _ := os.MkdirTemp("", "clone-test")
cloneOptions := &git.CloneOptions{
	URL:        gitURL,
	Progress:   os.Stdout,
}
git.PlainCloneContext(context.Background(), tmpDir, cloneOptions)
os.RemoveAll(tmpDir)

Additional Information

(screenshots are not from the same run)

Image

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions