`git gc` or `git clone` dies with `fatal: Out of memory, malloc failed (tried to allocate 1073741824 bytes)` or `error: pack-objects died of signal 9`.
AdvancedTroubleshootingRepository Health, Size and Performance
Answer
Likely causes → Delta compression of huge blobs inside a memory-limited container or small VM. pack-objects keeps a window of objects in memory per thread, so 8 threads × big blobs = OOM killer (signal 9).
Diagnose →
dmesg | grep -i -E 'killed process|out of memory'
git count-objects -vH
nproc; free -h
Fix → Limit packing memory and threads, then retry:
git config pack.windowMemory 256m
git config pack.threads 2
git config pack.deltaCacheSize 128m
git config core.bigFileThreshold 50m # store bigger files without delta attempts
git gc
For clones on tiny runners, use --depth 1 or --filter=blob:none.
Prevent → Keep huge binaries out of Git (LFS), and size Git servers and runners for the repo you actually have.
More on Repository Health, Size and Performance
`git status` takes 8–15 seconds in a large monorepo.Intermediate`error: The last gc run reported the following. Please correct the root cause and remove .git/gc.log` followed by `warning: There are too many unreachable loose objects; run 'git prune' to remove them.`IntermediateEvery few commands Git prints `Auto packing the repository in background for optimum performance.` and the machine stutters.BeginnerA fresh clone downloads 4 GB, but the checked-out files are only 200 MB.Intermediate`error: unable to create temporary file: No space left on device` followed by `fatal: failed to write object`.Beginner`git fsck` prints dozens of `dangling commit ...` and `dangling blob ...` lines. Is the repo broken?Beginner