Skip to content

Commit a571cb9

Browse files
pitrouwesm
authored andcommitted
ARROW-6549: [C++] Switch to jemalloc 5.2.x
Revert "ARROW-6478: [C++] Revert to jemalloc stable-4 until we understand 5.2.x performance issues" This reverts commit 53c5af0. In addition, configure jemalloc to fix the performance regression.
1 parent 3e6f8d1 commit a571cb9

File tree

5 files changed

+25
-27
lines changed

5 files changed

+25
-27
lines changed

cpp/cmake_modules/ThirdpartyToolchain.cmake

+8-4
Original file line numberDiff line numberDiff line change
@@ -1408,16 +1408,20 @@ if(ARROW_JEMALLOC)
14081408
"${JEMALLOC_PREFIX}/lib/libjemalloc_pic${CMAKE_STATIC_LIBRARY_SUFFIX}")
14091409
externalproject_add(
14101410
jemalloc_ep
1411-
URL ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/jemalloc/${JEMALLOC_VERSION}.tar.gz
1411+
URL ${JEMALLOC_SOURCE_URL}
14121412
PATCH_COMMAND touch doc/jemalloc.3 doc/jemalloc.html
1413-
CONFIGURE_COMMAND ./autogen.sh
1413+
# The prefix "je_arrow_" must be kept in sync with the value in memory_pool.cc
1414+
CONFIGURE_COMMAND ./configure
14141415
"AR=${CMAKE_AR}"
14151416
"CC=${CMAKE_C_COMPILER}"
14161417
"--prefix=${JEMALLOC_PREFIX}"
14171418
"--with-jemalloc-prefix=je_arrow_"
14181419
"--with-private-namespace=je_arrow_private_"
1419-
"--disable-tls"
1420-
${EP_LOG_OPTIONS}
1420+
"--without-export"
1421+
# Don't override operator new()
1422+
"--disable-cxx" "--disable-libdl"
1423+
# See https://github.com/jemalloc/jemalloc/issues/1237
1424+
"--disable-initial-exec-tls" ${EP_LOG_OPTIONS}
14211425
BUILD_IN_SOURCE 1
14221426
BUILD_COMMAND ${MAKE} ${MAKE_BUILD_ARGS}
14231427
BUILD_BYPRODUCTS "${JEMALLOC_STATIC_LIB}"

cpp/src/arrow/memory_pool.cc

+15
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,21 @@
3838
#include <mimalloc.h>
3939
#endif
4040

41+
#ifdef ARROW_JEMALLOC
42+
43+
// Compile-time configuration for jemalloc options.
44+
// Note the prefix ("je_arrow_") must match the symbol prefix given when
45+
// building jemalloc.
46+
// See discussion in https://github.com/jemalloc/jemalloc/issues/1621
47+
48+
#ifdef NDEBUG
49+
const char* je_arrow_malloc_conf = "oversize_threshold:0";
50+
#else
51+
// In debug mode, add memory poisoning on alloc / free
52+
const char* je_arrow_malloc_conf = "oversize_threshold:0,junk:true";
53+
#endif
54+
#endif
55+
4156
namespace arrow {
4257

4358
constexpr size_t kAlignment = 64;
Binary file not shown.

cpp/thirdparty/jemalloc/README.md

-22
This file was deleted.

cpp/thirdparty/versions.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ GFLAGS_VERSION=v2.2.0
3535
GLOG_VERSION=v0.3.5
3636
GRPC_VERSION=v1.20.0
3737
GTEST_VERSION=1.8.1
38-
JEMALLOC_VERSION=17c897976c60b0e6e4f4a365c751027244dada7a
38+
JEMALLOC_VERSION=5.2.1
3939
LZ4_VERSION=v1.8.3
4040
# Need post-v1.0.6 version for https://github.com/microsoft/mimalloc/pull/140,
4141
# https://github.com/microsoft/mimalloc/pull/145 and
@@ -72,6 +72,7 @@ DEPENDENCIES=(
7272
"ARROW_GLOG_URL glog-${GLOG_VERSION}.tar.gz https://github.com/google/glog/archive/${GLOG_VERSION}.tar.gz"
7373
"ARROW_GRPC_URL grpc-${GRPC_VERSION}.tar.gz https://github.com/grpc/grpc/archive/${GRPC_VERSION}.tar.gz"
7474
"ARROW_GTEST_URL gtest-${GTEST_VERSION}.tar.gz https://github.com/google/googletest/archive/release-${GTEST_VERSION}.tar.gz"
75+
"ARROW_JEMALLOC_URL jemalloc-${JEMALLOC_VERSION}.tar.bz2 https://github.com/jemalloc/jemalloc/releases/download/${JEMALLOC_VERSION}/jemalloc-${JEMALLOC_VERSION}.tar.bz2"
7576
"ARROW_LZ4_URL lz4-${LZ4_VERSION}.tar.gz https://github.com/lz4/lz4/archive/${LZ4_VERSION}.tar.gz"
7677
"ARROW_MIMALLOC_URL mimalloc-${MIMALLOC_VERSION}.tar.gz https://github.com/microsoft/mimalloc/archive/${MIMALLOC_VERSION}.tar.gz"
7778
"ARROW_ORC_URL orc-${ORC_VERSION}.tar.gz https://github.com/apache/orc/archive/rel/release-${ORC_VERSION}.tar.gz"

0 commit comments

Comments
 (0)