]> git.ipfire.org Git - thirdparty/git.git/commitdiff
mingw: stop using nedmalloc
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Fri, 8 May 2026 12:50:56 +0000 (12:50 +0000)
committerJunio C Hamano <gitster@pobox.com>
Sat, 9 May 2026 02:19:22 +0000 (11:19 +0900)
The vendored nedmalloc allocator under compat/nedmalloc/ has been
unmaintained upstream for a very long time: the original repository at
https://github.com/ned14/nedmalloc received its last commit on July 5,
2014, and was archived (made read-only) by its owner on March 15, 2019.
Our copy has been carried forward unchanged ever since.

The Git for Windows commit that introduced mimalloc as a replacement
on Windows ("mingw: use mimalloc", 2019-06-24, present in the Git for
Windows branch thicket but not upstream) already observed at that time
that nedmalloc had ceased to see any updates for several years.

This came to a head when the Git for Windows SDK upgraded to GCC 16:
the `add_segment()` function in `compat/nedmalloc/malloc.c.h` declares
`int nfences = 0` and only references it inside an `assert()`, which
GCC 16 now flags as `-Wunused-but-set-variable`. Combined with the
`-Werror` enabled by `DEVELOPER=1`, this turns into a hard build
failure:

compat/nedmalloc/malloc.c.h: In function 'add_segment':
compat/nedmalloc/malloc.c.h:3897:7: error: variable 'nfences' set but not used [-Werror=unused-but-set-variable=]
 3897 |   int nfences = 0;
      |       ^~~~~~~
cc1.exe: all warnings being treated as errors

The same source built without complaint under GCC 15.2.0; the
regression was bisected to the SDK package update at
https://github.com/git-for-windows/git-sdk-64/commit/188d93dd455
(`mingw-w64-x86_64-gcc 15.2.0-14 -> 16.1.0-1`), with the failing CI
run captured at
https://github.com/git-for-windows/git-sdk-64/actions/runs/25244795074.

Rather than patch the unmaintained vendored sources to silence the
warning, stop opting into nedmalloc altogether on Windows. The
platform allocator is what every non-MINGW build already uses, and a
fresh build of git.git's master against a minimal Git for Windows SDK
upgraded to GCC 16 completes successfully.

The compat/nedmalloc/ subtree itself is removed by subsequent commits
in this series.

Assisted-by: Opus 4.7
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
config.mak.uname
contrib/buildsystems/CMakeLists.txt
meson.build

index 5feb5825587e65f62a4ccbb507fbccd9f062693f..3636b982383a0421a780d04fe001cb582327b975 100644 (file)
@@ -758,9 +758,6 @@ ifeq ($(uname_S),MINGW)
        HAVE_LIBCHARSET_H = YesPlease
        USE_GETTEXT_SCHEME = fallthrough
        USE_LIBPCRE = YesPlease
-        ifneq (CLANGARM64,$(MSYSTEM))
-               USE_NED_ALLOCATOR = YesPlease
-        endif
         ifeq (/mingw64,$(subst 32,64,$(subst clangarm,mingw,$(prefix))))
                # Move system config into top-level /etc/
                ETC_GITCONFIG = ../etc/gitconfig
index 81b4306e72046c243f3aea5465490f28abd1e4e2..9d6b98ecb6baf3c38686473c66b3198e62f380c7 100644 (file)
@@ -255,7 +255,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
        add_compile_definitions(HAVE_ALLOCA_H NO_POSIX_GOODIES NATIVE_CRLF NO_UNIX_SOCKETS WIN32
                                _CONSOLE DETECT_MSYS_TTY STRIP_EXTENSION=".exe"  NO_SYMLINK_HEAD UNRELIABLE_FSTAT
                                NOGDI OBJECT_CREATION_MODE=1 __USE_MINGW_ANSI_STDIO=0
-                               USE_NED_ALLOCATOR OVERRIDE_STRDUP MMAP_PREVENTS_DELETE USE_WIN32_MMAP
+                               OVERRIDE_STRDUP MMAP_PREVENTS_DELETE USE_WIN32_MMAP
                                HAVE_WPGMPTR ENSURE_MSYSTEM_IS_SET HAVE_RTLGENRANDOM)
        list(APPEND compat_SOURCES
                compat/mingw.c
@@ -267,7 +267,6 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
                compat/win32/syslog.c
                compat/win32/trace2_win32_process_info.c
                compat/win32/dirent.c
-               compat/nedmalloc/nedmalloc.c
                compat/strdup.c)
        set(NO_UNIX_SOCKETS 1)
 
index 11488623bfd8f8303cb3e870d700b2072cffffdb..e896bc15a15dc037f3fd3910ebad9cf2e6d7bfc2 100644 (file)
@@ -1285,7 +1285,6 @@ elif host_machine.system() == 'windows'
     'compat/win32/pthread.c',
     'compat/win32/syslog.c',
     'compat/win32mmap.c',
-    'compat/nedmalloc/nedmalloc.c',
   ]
 
   libgit_c_args += [