Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ci/conda_env_cpp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ meson
ninja
nodejs
orc
patch
pkg-config
python
rapidjson
Expand Down
1 change: 1 addition & 0 deletions ci/docker/debian-12-cpp.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ RUN apt-get update -y -q && \
ninja-build \
nlohmann-json3-dev \
npm \
patch \
pkg-config \
protobuf-compiler-grpc \
python3-dev \
Expand Down
1 change: 1 addition & 0 deletions ci/docker/debian-13-cpp.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ RUN apt-get update -y -q && \
nlohmann-json3-dev \
npm \
opentelemetry-cpp-dev \
patch \
pkg-config \
protobuf-compiler-grpc \
python3-dev \
Expand Down
1 change: 1 addition & 0 deletions ci/docker/debian-experimental-cpp.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ RUN if [ -n "${gcc}" ]; then \
nlohmann-json3-dev \
npm \
opentelemetry-cpp-dev \
patch \
pkg-config \
protobuf-compiler-grpc \
python3-dev \
Expand Down
1 change: 1 addition & 0 deletions ci/docker/fedora-42-cpp.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ RUN dnf update -y && \
make \
ninja-build \
openssl-devel \
patch \
protobuf-devel \
python \
python-devel \
Expand Down
1 change: 1 addition & 0 deletions ci/docker/ubuntu-22.04-cpp-minimal.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ RUN apt-get update -y -q && \
git \
libssl-dev \
libcurl4-openssl-dev \
patch \
python3-pip \
python3-venv \
tzdata \
Expand Down
1 change: 1 addition & 0 deletions ci/docker/ubuntu-22.04-cpp.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ RUN apt-get update -y -q && \
ninja-build \
nlohmann-json3-dev \
npm \
patch \
pkg-config \
protobuf-compiler \
protobuf-compiler-grpc \
Expand Down
1 change: 1 addition & 0 deletions ci/docker/ubuntu-24.04-cpp-minimal.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ RUN apt-get update -y -q && \
git \
libssl-dev \
libcurl4-openssl-dev \
patch \
python3-pip \
python3-venv \
tzdata \
Expand Down
1 change: 1 addition & 0 deletions ci/docker/ubuntu-24.04-cpp.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ RUN apt-get update -y -q && \
ninja-build \
nlohmann-json3-dev \
npm \
patch \
pkg-config \
protobuf-compiler \
protobuf-compiler-grpc \
Expand Down
1 change: 1 addition & 0 deletions ci/scripts/msys2_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ case "${target}" in
packages+=("${MINGW_PACKAGE_PREFIX}-lz4")
packages+=("${MINGW_PACKAGE_PREFIX}-ninja")
packages+=("${MINGW_PACKAGE_PREFIX}-nlohmann-json")
packages+=("${MINGW_PACKAGE_PREFIX}-patch")
packages+=("${MINGW_PACKAGE_PREFIX}-protobuf")
packages+=("${MINGW_PACKAGE_PREFIX}-rapidjson")
packages+=("${MINGW_PACKAGE_PREFIX}-re2")
Expand Down
10 changes: 8 additions & 2 deletions cpp/cmake_modules/ThirdpartyToolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2275,9 +2275,9 @@ if(ARROW_MIMALLOC)
endif()

set(MIMALLOC_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/mimalloc_ep/src/mimalloc_ep")
set(MIMALLOC_INCLUDE_DIR "${MIMALLOC_PREFIX}/include/mimalloc-2.2")
set(MIMALLOC_INCLUDE_DIR "${MIMALLOC_PREFIX}/include")
set(MIMALLOC_STATIC_LIB
"${MIMALLOC_PREFIX}/lib/mimalloc-2.2/${CMAKE_STATIC_LIBRARY_PREFIX}${MIMALLOC_LIB_BASE_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}"
"${MIMALLOC_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}${MIMALLOC_LIB_BASE_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}"
)

set(MIMALLOC_C_FLAGS ${EP_C_FLAGS})
Expand All @@ -2286,10 +2286,15 @@ if(ARROW_MIMALLOC)
set(MIMALLOC_C_FLAGS "${MIMALLOC_C_FLAGS} -DERROR_COMMITMENT_MINIMUM=635")
endif()

find_program(PATCH patch REQUIRED)
set(MIMALLOC_PATCH_COMMAND ${PATCH} -p1 -i
${CMAKE_CURRENT_LIST_DIR}/mimalloc-1138.patch)

set(MIMALLOC_CMAKE_ARGS
${EP_COMMON_CMAKE_ARGS}
"-DCMAKE_C_FLAGS=${MIMALLOC_C_FLAGS}"
"-DCMAKE_INSTALL_PREFIX=${MIMALLOC_PREFIX}"
-DMI_INSTALL_TOPLEVEL=ON
-DMI_OVERRIDE=OFF
-DMI_LOCAL_DYNAMIC_TLS=ON
-DMI_BUILD_OBJECT=OFF
Expand All @@ -2300,6 +2305,7 @@ if(ARROW_MIMALLOC)
${EP_COMMON_OPTIONS}
URL ${MIMALLOC_SOURCE_URL}
URL_HASH "SHA256=${ARROW_MIMALLOC_BUILD_SHA256_CHECKSUM}"
PATCH_COMMAND ${MIMALLOC_PATCH_COMMAND}
CMAKE_ARGS ${MIMALLOC_CMAKE_ARGS}
BUILD_BYPRODUCTS "${MIMALLOC_STATIC_LIB}")

Expand Down
33 changes: 33 additions & 0 deletions cpp/cmake_modules/mimalloc-1138.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

Fix for https://github.com/microsoft/mimalloc/issues/1138

diff --git a/src/arena.c b/src/arena.c
index b26f4442..d7e99b55 100644
--- a/src/arena.c
+++ b/src/arena.c
@@ -797,6 +797,9 @@ mi_page_t* _mi_arenas_page_alloc(mi_heap_t* heap, size_t block_size, size_t bloc
else {
page = mi_arenas_page_singleton_alloc(heap, block_size, block_alignment);
}
+ if mi_unlikely(page == NULL) {
+ return NULL;
+ }
// mi_assert_internal(page == NULL || _mi_page_segment(page)->subproc == tld->subproc);
mi_assert_internal(_mi_is_aligned(page, MI_PAGE_ALIGN));
mi_assert_internal(_mi_ptr_page(page)==page);
4 changes: 2 additions & 2 deletions cpp/thirdparty/versions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ ARROW_JEMALLOC_BUILD_VERSION=5.3.0
ARROW_JEMALLOC_BUILD_SHA256_CHECKSUM=2db82d1e7119df3e71b7640219b6dfe84789bc0537983c3b7ac4f7189aecfeaa
ARROW_LZ4_BUILD_VERSION=v1.10.0
ARROW_LZ4_BUILD_SHA256_CHECKSUM=537512904744b35e232912055ccf8ec66d768639ff3abe5788d90d792ec5f48b
ARROW_MIMALLOC_BUILD_VERSION=v2.2.4
ARROW_MIMALLOC_BUILD_SHA256_CHECKSUM=754a98de5e2912fddbeaf24830f982b4540992f1bab4a0a8796ee118e0752bda
ARROW_MIMALLOC_BUILD_VERSION=v3.1.5
ARROW_MIMALLOC_BUILD_SHA256_CHECKSUM=1c6949032069d5ebea438ec5cedd602d06f40a92ddf0f0d9dcff0993e5f6635c
ARROW_NLOHMANN_JSON_BUILD_VERSION=v3.12.0
ARROW_NLOHMANN_JSON_BUILD_SHA256_CHECKSUM=4b92eb0c06d10683f7447ce9406cb97cd4b453be18d7279320f7b2f025c10187
ARROW_OPENTELEMETRY_BUILD_VERSION=v1.21.0
Expand Down
Loading