Skip to content

Commit c318488

Browse files
dschoGit for Windows Build Agent
authored andcommitted
Merge branch 'mimalloc-v2.2.3'
This topic vendors in mimalloc v2.2.3, a fast allocator that allows Git for Windows to perform efficiently. Signed-off-by: Johannes Schindelin <[email protected]>
2 parents d6c8a0a + 53122f8 commit c318488

37 files changed

+16459
-10
lines changed

Makefile

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1346,6 +1346,7 @@ BUILTIN_OBJS += builtin/write-tree.o
13461346
# upstream unnecessarily (making merging in future changes easier).
13471347
THIRD_PARTY_SOURCES += compat/inet_ntop.c
13481348
THIRD_PARTY_SOURCES += compat/inet_pton.c
1349+
THIRD_PARTY_SOURCES += compat/mimalloc/%
13491350
THIRD_PARTY_SOURCES += compat/nedmalloc/%
13501351
THIRD_PARTY_SOURCES += compat/obstack.%
13511352
THIRD_PARTY_SOURCES += compat/poll/%
@@ -2149,6 +2150,46 @@ ifdef USE_NED_ALLOCATOR
21492150
OVERRIDE_STRDUP = YesPlease
21502151
endif
21512152

2153+
ifdef USE_MIMALLOC
2154+
MIMALLOC_OBJS = \
2155+
compat/mimalloc/alloc-aligned.o \
2156+
compat/mimalloc/alloc.o \
2157+
compat/mimalloc/arena.o \
2158+
compat/mimalloc/bitmap.o \
2159+
compat/mimalloc/heap.o \
2160+
compat/mimalloc/init.o \
2161+
compat/mimalloc/libc.o \
2162+
compat/mimalloc/options.o \
2163+
compat/mimalloc/os.o \
2164+
compat/mimalloc/page.o \
2165+
compat/mimalloc/random.o \
2166+
compat/mimalloc/prim/prim.o \
2167+
compat/mimalloc/segment.o \
2168+
compat/mimalloc/segment-map.o \
2169+
compat/mimalloc/stats.o
2170+
2171+
COMPAT_CFLAGS += -Icompat/mimalloc -DMI_DEBUG=0 -DUSE_MIMALLOC --std=gnu11
2172+
COMPAT_OBJS += $(MIMALLOC_OBJS)
2173+
2174+
$(MIMALLOC_OBJS): COMPAT_CFLAGS += -DBANNED_H
2175+
2176+
$(MIMALLOC_OBJS): COMPAT_CFLAGS += \
2177+
-DMI_WIN_USE_FLS \
2178+
-Wno-attributes \
2179+
-Wno-unknown-pragmas \
2180+
-Wno-unused-function \
2181+
-Wno-array-bounds
2182+
2183+
ifdef DEVELOPER
2184+
$(MIMALLOC_OBJS): COMPAT_CFLAGS += \
2185+
-Wno-pedantic \
2186+
-Wno-declaration-after-statement \
2187+
-Wno-old-style-definition \
2188+
-Wno-missing-prototypes \
2189+
-Wno-implicit-function-declaration
2190+
endif
2191+
endif
2192+
21522193
ifdef OVERRIDE_STRDUP
21532194
COMPAT_CFLAGS += -DOVERRIDE_STRDUP
21542195
COMPAT_OBJS += compat/strdup.o

compat/.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
/zlib-uncompress2.c whitespace=-indent-with-non-tab,-trailing-space
2+
/mimalloc/**/* whitespace=-trailing-space

compat/mimalloc/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018-2025 Microsoft Corporation, Daan Leijen
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)