Enable jemalloc heap profiling with libunwind backtraces

Build libunwind 1.8.3 as a static library before jemalloc, then
configure jemalloc with --enable-prof --enable-prof-libunwind so the
static libjemalloc.a can dump heap profiles with accurate stack
traces.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Sd7pBDVxQENBX1CP2z6Lip
This commit is contained in:
GuofangandClaude Sonnet 5 committed 2026-09-17 13:59:41 +08:00
1 parent 195ad299cd
commit e685a177d5
3 files changed
+73 -18

No files matched your search

+17
View File
@@ -551,6 +551,21 @@ RUN git clone --branch=1.3.15 --depth=1 https://github.com/sewenew/redis-plus-pl
&& cmake --build build --parallel "$(nproc)" --target install \
&& rm -rf build src
RUN git clone --branch=v1.8.3 --depth=1 https://github.com/libunwind/libunwind.git src \
&& cd src \
&& autoreconf --install \
&& CFLAGS=-fPIC ./configure --prefix=/usr/local \
--disable-shared \
--enable-static \
--disable-tests \
--disable-documentation \
--disable-minidebuginfo \
--disable-zlibdebuginfo \
&& make --jobs="$(nproc)" \
&& make install \
&& cd .. \
&& rm -rf src
RUN git clone --branch=5.3.1 --depth=1 https://github.com/jemalloc/jemalloc.git src \
&& cd src \
&& ./autogen.sh \
@@ -558,6 +573,8 @@ RUN git clone --branch=5.3.1 --depth=1 https://github.com/jemalloc/jemalloc.git
--disable-doc \
--disable-shared \
--enable-static \
--enable-prof \
--enable-prof-libunwind \
&& make --jobs="$(nproc)" \
&& make install \
&& cd .. \