A bit OT: git - ridiculous memory requirements

Bryn M. Reeves bmr at redhat.com
Fri Mar 30 10:00:50 UTC 2012


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 03/30/2012 04:13 AM, Vaclav Mocek wrote:
> Hi all,
> 
> I have a cloned GCC git repository, on PC with 1.5GB of RAM and 3GB
> swap.
> 
> When I run "$git gc --aggressive", I will get after few hours an
> error:
> 
> $ git gc --aggressive Counting objects: 1332887, done. Delta
> compression using up to 2 threads. fatal: Out of memory, malloc
> failed (tried to allocate 4838335 bytes) error: failed to run
> repack $
> 
> 4.5GB of memory is not enough, what is that?
> 
> I wonder what git is internally doing, it seems to me as a pretty 
> non-optimal implementation. It is the first application I have
> which has been killed by OOM killer.

Are you sure it got oom-killed? It appears to have just received a
malloc failure and quit. You'd expect abnormal termination via a
signal for an oomkill.

It would also be interesting to see the /proc/<pid>/{s,}maps output or
even a top snapshot of the git process before this happens - the
failing allocation was only for a little over 4MiB.

You might also get better results trying git-repack or git-fsck on
your tree first (git-repack on a cluttered repo can speed things up
greatly although I don't know if you may run into similar memory
consumption problems there).

With that said I'm not sure the behaviour is that out of line
considering the description of --aggressive:

  --aggressive
     Usually git gc runs very quickly while providing good disk
     space utilization and performance. This option will cause
     git gc to more aggressively optimize the repository at the
     expense of taking much more time. The effects of this
     optimization are persistent, so this option only needs to be
     used occasionally; every few hundred changesets or so.

Regards,
Bryn.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk91hFIACgkQ6YSQoMYUY95aQwCgzJQyBla5KRwQR4NF5BcVy70p
CEYAn0NWuCW7S271KHivb20OlfBUTPov
=DRP/
-----END PGP SIGNATURE-----


More information about the users mailing list