Interview Prep/Git & GitHub/Repository Health, Size and Performance

`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.

All Git & GitHub questions Roadmap: Git & GitHub

More on Repository Health, Size and Performance