From 0fba439f2136a058aa118ac0485938cb05058efe Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Sun, 21 Aug 2016 12:37:50 -0700 Subject: [PATCH] memory: use core.packedGitWindowSize=32m unless $cfg_git_no_mmap The default value for core.packedGitWindowSize on a 64-bit platform where Git was built WITHOUT setting NO_MMAP can lead to unwanted memory blowout when running many packing threads. Instead always set the 32-bit value (32 MiB). However, on some platforms, Git must be built with NO_MMAP in order to function properly. Therefore provide an escape hatch in that if $Girocco::Config::git_no_mmap is set to a true value then always set core.packedGitWindowSize to 1 MiB instead (which is what happens when Git is built with NO_MMAP). Signed-off-by: Kyle J. McKay --- Girocco/Config.pm | 8 ++++++++ shlib.sh | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/Girocco/Config.pm b/Girocco/Config.pm index e1f8ece..ce7d0bd 100644 --- a/Girocco/Config.pm +++ b/Girocco/Config.pm @@ -757,6 +757,13 @@ our @blocked_tags = (); # Values less than 1000 * number of CPU cores will be silently ignored. our $new_delta_threshold = undef; +# If this is set to a true value, then core.packedGitWindowSize will be set +# to 1 MiB the same as if Git was compiled with NO_MMAP set. If this is NOT +# set, core.packedGitWindowSize will be set to 32 MiB (even on 64-bit) to avoid +# memory blowout. If your Git was built with NO_MMAP set and will not work +# without NO_MMAP set, you MUST set this to a true value! +our $git_no_mmap = undef; + # If set to a true value, the "X-Girocco: $gitweburl" header included in all # Girocco-generated emails will be suppressed. our $suppress_x_girocco = undef; @@ -814,6 +821,7 @@ our $httpsdnsname = ($httpspushurl =~ m,https://([A-Za-z0-9.-]+),i) ? lc($1) : u or die "Girocco::Config \$svn_log_window_size must be undef or numeric"; (not $posix_sh_bin or $posix_sh_bin !~ /\s/) or die "Girocco::Config: \$posix_sh_bin must not contain any whitespace"; (not $perl_bin or $perl_bin !~ /\s/) or die "Girocco::Config: \$perl_bin must not contain any whitespace"; +!$git_no_mmap and $git_no_mmap = undef; !$suppress_x_girocco and $suppress_x_girocco = undef; # Make sure Git has a consistent and reproducible environment diff --git a/shlib.sh b/shlib.sh index 19ab878..a568695 100644 --- a/shlib.sh +++ b/shlib.sh @@ -177,6 +177,13 @@ if [ -n "$defined_cfg_git_client_ua" ]; then fi unset GIT_CONFIG_PARAMETERS git_add_config "core.ignoreCase=false" +if [ -n "$cfg_git_no_mmap" ]; then + # Just like compiling with NO_MMAP + git_add_config "core.packedGitWindowSize=1m" +else + # Always use the 32-bit default (32m) even on 64-bit to avoid memory blowout + git_add_config "core.packedGitWindowSize=32m" +fi [ -z "$var_big_file_threshold" ] || git_add_config "core.bigFileThreshold=$var_big_file_threshold" -- 2.11.4.GIT