Skip to content

Commit 5dc04db

Browse files
dschoGit for Windows Build Agent
authored andcommitted
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 bc77c16 + baaea02 commit 5dc04db

37 files changed

Lines changed: 16757 additions & 10 deletions

Makefile

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1504,6 +1504,7 @@ BUILTIN_OBJS += builtin/write-tree.o
15041504
# upstream unnecessarily (making merging in future changes easier).
15051505
THIRD_PARTY_SOURCES += compat/inet_ntop.c
15061506
THIRD_PARTY_SOURCES += compat/inet_pton.c
1507+
THIRD_PARTY_SOURCES += compat/mimalloc/%
15071508
THIRD_PARTY_SOURCES += compat/nedmalloc/%
15081509
THIRD_PARTY_SOURCES += compat/obstack.%
15091510
THIRD_PARTY_SOURCES += compat/poll/%
@@ -2261,6 +2262,46 @@ ifdef USE_NED_ALLOCATOR
22612262
OVERRIDE_STRDUP = YesPlease
22622263
endif
22632264

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