Skip to content

Commit f393747

Browse files
committed
Merge branch 'np/maint-limit-delta-cache' into maint
* np/maint-limit-delta-cache: don't let the delta cache grow unbounded in 'git repack'
2 parents 985d540 + 5749b0b commit f393747

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

Documentation/config.txt

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,12 +1218,20 @@ pack.compression::
12181218

12191219
pack.deltaCacheSize::
12201220
The maximum memory in bytes used for caching deltas in
1221-
linkgit:git-pack-objects[1].
1222-
A value of 0 means no limit. Defaults to 0.
1221+
linkgit:git-pack-objects[1] before writing them out to a pack.
1222+
This cache is used to speed up the writing object phase by not
1223+
having to recompute the final delta result once the best match
1224+
for all objects is found. Repacking large repositories on machines
1225+
which are tight with memory might be badly impacted by this though,
1226+
especially if this cache pushes the system into swapping.
1227+
A value of 0 means no limit. The smallest size of 1 byte may be
1228+
used to virtually disable this cache. Defaults to 256 MiB.
12231229

12241230
pack.deltaCacheLimit::
12251231
The maximum size of a delta, that is cached in
1226-
linkgit:git-pack-objects[1]. Defaults to 1000.
1232+
linkgit:git-pack-objects[1]. This cache is used to speed up the
1233+
writing object phase by not having to recompute the final delta
1234+
result once the best match for all objects is found. Defaults to 1000.
12271235

12281236
pack.threads::
12291237
Specifies the number of threads to spawn when searching for best

builtin-pack-objects.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ static int pack_compression_level = Z_DEFAULT_COMPRESSION;
8686
static int pack_compression_seen;
8787

8888
static unsigned long delta_cache_size = 0;
89-
static unsigned long max_delta_cache_size = 0;
89+
static unsigned long max_delta_cache_size = 256 * 1024 * 1024;
9090
static unsigned long cache_max_small_delta_size = 1000;
9191

9292
static unsigned long window_memory_limit = 0;

0 commit comments

Comments
 (0)