Skip to content

Commit f92d99e

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 266dbda + 6e62ab0 commit f92d99e

37 files changed

+16623
-10
lines changed

Makefile

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1492,6 +1492,7 @@ BUILTIN_OBJS += builtin/write-tree.o
14921492
# upstream unnecessarily (making merging in future changes easier).
14931493
THIRD_PARTY_SOURCES += compat/inet_ntop.c
14941494
THIRD_PARTY_SOURCES += compat/inet_pton.c
1495+
THIRD_PARTY_SOURCES += compat/mimalloc/%
14951496
THIRD_PARTY_SOURCES += compat/nedmalloc/%
14961497
THIRD_PARTY_SOURCES += compat/obstack.%
14971498
THIRD_PARTY_SOURCES += compat/poll/%
@@ -2215,6 +2216,46 @@ ifdef USE_NED_ALLOCATOR
22152216
OVERRIDE_STRDUP = YesPlease
22162217
endif
22172218

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