Skip to content

Commit c365c29

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 43b44b0 + c24974d commit c365c29

37 files changed

+16623
-10
lines changed

Makefile

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1505,6 +1505,7 @@ BUILTIN_OBJS += builtin/write-tree.o
15051505
# upstream unnecessarily (making merging in future changes easier).
15061506
THIRD_PARTY_SOURCES += compat/inet_ntop.c
15071507
THIRD_PARTY_SOURCES += compat/inet_pton.c
1508+
THIRD_PARTY_SOURCES += compat/mimalloc/%
15081509
THIRD_PARTY_SOURCES += compat/nedmalloc/%
15091510
THIRD_PARTY_SOURCES += compat/obstack.%
15101511
THIRD_PARTY_SOURCES += compat/poll/%
@@ -2263,6 +2264,46 @@ ifdef USE_NED_ALLOCATOR
22632264
OVERRIDE_STRDUP = YesPlease
22642265
endif
22652266

2267+
ifdef USE_MIMALLOC
2268+
MIMALLOC_OBJS = \
2269+
compat/mimalloc/alloc-aligned.o \
2270+
compat/mimalloc/alloc.o \
2271+
compat/mimalloc/arena.o \
2272+
compat/mimalloc/bitmap.o \
2273+
compat/mimalloc/heap.o \
2274+
compat/mimalloc/init.o \
2275+
compat/mimalloc/libc.o \
2276+
compat/mimalloc/options.o \
2277+
compat/mimalloc/os.o \
2278+
compat/mimalloc/page.o \
2279+
compat/mimalloc/random.o \
2280+
compat/mimalloc/prim/prim.o \
2281+
compat/mimalloc/segment.o \
2282+
compat/mimalloc/segment-map.o \
2283+
compat/mimalloc/stats.o
2284+
2285+
COMPAT_CFLAGS += -Icompat/mimalloc -DMI_DEBUG=0 -DUSE_MIMALLOC --std=gnu11
2286+
COMPAT_OBJS += $(MIMALLOC_OBJS)
2287+
2288+
$(MIMALLOC_OBJS): COMPAT_CFLAGS += -DBANNED_H
2289+
2290+
$(MIMALLOC_OBJS): COMPAT_CFLAGS += \
2291+
-DMI_WIN_USE_FLS \
2292+
-Wno-attributes \
2293+
-Wno-unknown-pragmas \
2294+
-Wno-unused-function \
2295+
-Wno-array-bounds
2296+
2297+
ifdef DEVELOPER
2298+
$(MIMALLOC_OBJS): COMPAT_CFLAGS += \
2299+
-Wno-pedantic \
2300+
-Wno-declaration-after-statement \
2301+
-Wno-old-style-definition \
2302+
-Wno-missing-prototypes \
2303+
-Wno-implicit-function-declaration
2304+
endif
2305+
endif
2306+
22662307
ifdef OVERRIDE_STRDUP
22672308
COMPAT_CFLAGS += -DOVERRIDE_STRDUP
22682309
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)