Skip to content

Commit 1d5a4a7

Browse files
committed
Update mimalloc to v2.2.7 (#6048)
After releasing v2.2.6, they followed up really quickly with a v2.2.7, which indicates some urgency in taking this update. The diff of this PR is pretty informative, too. This closes #6046
2 parents 2e5dcce + dfc49d0 commit 1d5a4a7

37 files changed

Lines changed: 16757 additions & 10 deletions

Makefile

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1502,6 +1502,7 @@ BUILTIN_OBJS += builtin/write-tree.o
15021502
# upstream unnecessarily (making merging in future changes easier).
15031503
THIRD_PARTY_SOURCES += compat/inet_ntop.c
15041504
THIRD_PARTY_SOURCES += compat/inet_pton.c
1505+
THIRD_PARTY_SOURCES += compat/mimalloc/%
15051506
THIRD_PARTY_SOURCES += compat/nedmalloc/%
15061507
THIRD_PARTY_SOURCES += compat/obstack.%
15071508
THIRD_PARTY_SOURCES += compat/poll/%
@@ -2259,6 +2260,46 @@ ifdef USE_NED_ALLOCATOR
22592260
OVERRIDE_STRDUP = YesPlease
22602261
endif
22612262

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