Skip to content
Merged
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
17 changes: 17 additions & 0 deletions thirdparty/build-thirdparty.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1255,6 +1255,22 @@ build_hdfs3() {
make install
}

# jemalloc
build_jemalloc() {
check_if_source_exist "${JEMALLOC_SOURCE}"
cd "${TP_SOURCE_DIR}/${JEMALLOC_SOURCE}"

mkdir -p "${BUILD_DIR}"
cd "${BUILD_DIR}"

cflags='-O3 -fno-omit-frame-pointer -fPIC -g'
CFLAGS="${cflags}" ../configure --prefix="${TP_INSTALL_DIR}" --with-jemalloc-prefix=je --enable-prof --disable-cxx --disable-libdl --disable-shared

make -j "${PARALLEL}"
make install
mv "${TP_INSTALL_DIR}"/lib/libjemalloc.a "${TP_INSTALL_DIR}"/lib/libjemalloc_doris.a
}

# benchmark
build_benchmark() {
check_if_source_exist "${BENCHMARK_SOURCE}"
Expand Down Expand Up @@ -1360,6 +1376,7 @@ build_cyrus_sasl
build_librdkafka
build_flatbuffers
build_orc
build_jemalloc
build_arrow
build_s2
build_bitshuffle
Expand Down
11 changes: 11 additions & 0 deletions thirdparty/download-thirdparty.sh
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,17 @@ if [[ "${LIBRDKAFKA_SOURCE}" == "librdkafka-1.8.2" ]]; then
fi
echo "Finished patching ${LIBRDKAFKA_SOURCE}"

# patch jemalloc, disable JEMALLOC_MANGLE for overloading the memory API.
if [[ "${JEMALLOC_SOURCE}" = "jemalloc-5.2.1" ]]; then
cd "${TP_SOURCE_DIR}/${JEMALLOC_SOURCE}"
if [[ ! -f "${PATCHED_MARK}" ]]; then
patch -p0 <"${TP_PATCH_DIR}/jemalloc_hook.patch"
touch "${PATCHED_MARK}"
fi
cd -
fi
echo "Finished patching ${JEMALLOC_SOURCE}"

# patch hyperscan
# https://github.com/intel/hyperscan/issues/292
if [[ "${HYPERSCAN_SOURCE}" == "hyperscan-5.4.0" ]]; then
Expand Down
11 changes: 11 additions & 0 deletions thirdparty/patches/jemalloc_hook.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- include/jemalloc/jemalloc.sh
+++ include/jemalloc/jemalloc.sh
@@ -12,7 +12,7 @@ extern "C" {
EOF

for hdr in jemalloc_defs.h jemalloc_rename.h jemalloc_macros.h \
- jemalloc_protos.h jemalloc_typedefs.h jemalloc_mangle.h ; do
+ jemalloc_protos.h jemalloc_typedefs.h ; do
cat "${objroot}include/jemalloc/${hdr}" \
| grep -v 'Generated from .* by configure\.' \
| sed -e 's/ $//g'