git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: gc --aggressive

From
Jeff King <peff@peff.net>
Date
Apr 17, 2012, 22:08 UTC
Message-ID
<20120417220838.GB10797@sigill.intra.peff.net>
In-Reply-To
<CAG+J_DzO=UZ56PjnSCRaTdj8pBSYc5PFofw1QHy42c5pHMK_HQ@mail.gmail.com>
On Tue, Apr 17, 2012 at 12:16:15PM -0400, Jay Soffian wrote:
Show 17 quoted lines
> For a couple years now I've had a maintenance script which repacks all
> the repos at @dayjob thusly:
> 
>   git config repack.usedeltabaseoffset true
>   git config pack.compression 9
>   git config pack.indexversion 2
>   git config gc.autopacklimit 4
>   git config gc.packrefs true
>   git config gc.reflogexpire never
>   git config gc.reflogexpireunreachable never
>   git gc --auto --aggressive --prune
> 
> This has worked fine on repos large and small. However, starting a
> couple days ago git started running out of memory on a relatively
> modest repo[*] while repacking on a Linux box with 12GB memory (+ 12GB
> swap). I am able to gc the repo by either removing --aggressive or
> .keep'ing the oldest pack.

I wonder where the memory is going. In theory, the memory consumption for packing comes from keeping all of the objects for a given window in memory (so we are looking for a delta for object X, and we have a window of Y[0]..Y[$window] objects that we will consider). And for a multi-threaded pack, that's per-thread.

How many cores are there on this box? Have you tried setting pack.windowMemory to (12 / # of cores) or thereabouts?

> 1) If --aggressive does not generally provide a benefit, should it be
> made a no-op?

In your case, I think it is overkill. But it seems lame that git _can't_ do a full repack on such a beefy machine. You don't want to do it all the time, but you might want to do it at least once.

-Peff
Previous: Nicolas PitreNext: Junio C Hamano
Message 21 of 26 in “gc --aggressive”
  1. Jay SoffianApr 17, 2012
  2. Jay SoffianApr 17, 2012
  3. Matthieu MoyApr 17, 2012
  4. Jeff KingApr 17, 2012
  5. Jeff KingApr 28, 2012
  6. Nicolas PitreApr 28, 2012
  7. Jeff KingApr 29, 2012
  8. Nicolas PitreApr 29, 2012
  9. Jeff KingMay 1, 2012
  10. Jeff KingMay 1, 2012
  11. Nicolas PitreMay 1, 2012
  12. Junio C HamanoMay 1, 2012
  13. Nicolas PitreMay 1, 2012
  14. Jeff KingMay 1, 2012
  15. Jeff KingMay 1, 2012
  16. Nicolas PitreMay 1, 2012
  17. Nicolas PitreMay 1, 2012
  18. Jeff KingMay 1, 2012
  19. Nicolas PitreMay 1, 2012
  20. Nicolas PitreApr 28, 2012
  21. Jeff KingApr 17, 2012
  22. Junio C HamanoApr 17, 2012
  23. Jeff KingApr 17, 2012
  24. Junio C HamanoApr 17, 2012
  25. Nicolas PitreApr 28, 2012
  26. Andreas EricssonApr 18, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.