Skip to content

Commit 77643f1

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 a2bd115 + bc151ba commit 77643f1

37 files changed

+16623
-10
lines changed

Makefile

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1494,6 +1494,7 @@ BUILTIN_OBJS += builtin/write-tree.o
14941494
# upstream unnecessarily (making merging in future changes easier).
14951495
THIRD_PARTY_SOURCES += compat/inet_ntop.c
14961496
THIRD_PARTY_SOURCES += compat/inet_pton.c
1497+
THIRD_PARTY_SOURCES += compat/mimalloc/%
14971498
THIRD_PARTY_SOURCES += compat/nedmalloc/%
14981499
THIRD_PARTY_SOURCES += compat/obstack.%
14991500
THIRD_PARTY_SOURCES += compat/poll/%
@@ -2222,6 +2223,46 @@ ifdef USE_NED_ALLOCATOR
22222223
OVERRIDE_STRDUP = YesPlease
22232224
endif
22242225

2226+
ifdef USE_MIMALLOC
2227+
MIMALLOC_OBJS = \
2228+
compat/mimalloc/alloc-aligned.o \
2229+
compat/mimalloc/alloc.o \
2230+
compat/mimalloc/arena.o \
2231+
compat/mimalloc/bitmap.o \
2232+
compat/mimalloc/heap.o \
2233+
compat/mimalloc/init.o \
2234+
compat/mimalloc/libc.o \
2235+
compat/mimalloc/options.o \
2236+
compat/mimalloc/os.o \
2237+
compat/mimalloc/page.o \
2238+
compat/mimalloc/random.o \
2239+
compat/mimalloc/prim/prim.o \
2240+
compat/mimalloc/segment.o \
2241+
compat/mimalloc/segment-map.o \
2242+
compat/mimalloc/stats.o
2243+
2244+
COMPAT_CFLAGS += -Icompat/mimalloc -DMI_DEBUG=0 -DUSE_MIMALLOC --std=gnu11
2245+
COMPAT_OBJS += $(MIMALLOC_OBJS)
2246+
2247+
$(MIMALLOC_OBJS): COMPAT_CFLAGS += -DBANNED_H
2248+
2249+
$(MIMALLOC_OBJS): COMPAT_CFLAGS += \
2250+
-DMI_WIN_USE_FLS \
2251+
-Wno-attributes \
2252+
-Wno-unknown-pragmas \
2253+
-Wno-unused-function \
2254+
-Wno-array-bounds
2255+
2256+
ifdef DEVELOPER
2257+
$(MIMALLOC_OBJS): COMPAT_CFLAGS += \
2258+
-Wno-pedantic \
2259+
-Wno-declaration-after-statement \
2260+
-Wno-old-style-definition \
2261+
-Wno-missing-prototypes \
2262+
-Wno-implicit-function-declaration
2263+
endif
2264+
endif
2265+
22252266
ifdef OVERRIDE_STRDUP
22262267
COMPAT_CFLAGS += -DOVERRIDE_STRDUP
22272268
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)