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

+21
View File
@@ -628,6 +628,25 @@ RUN curl --fail --location --output redis-plus-plus.tar.gz \
&& cmake --build build --parallel "$(nproc)" --target install \
&& rm -rf build src
RUN curl --fail --location --output libunwind.tar.gz \
https://wangguofang.net/github.com/libunwind/libunwind/archive/v1.8.3.tar.gz \
&& mkdir src \
&& tar --extract --gzip --file=libunwind.tar.gz --directory=src --strip-components=1 \
&& rm libunwind.tar.gz \
&& 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 curl --fail --location --output jemalloc.tar.gz \
https://wangguofang.net/github.com/jemalloc/jemalloc/archive/5.3.1.tar.gz \
&& mkdir src \
@@ -639,6 +658,8 @@ RUN curl --fail --location --output jemalloc.tar.gz \
--disable-doc \
--disable-shared \
--enable-static \
--enable-prof \
--enable-prof-libunwind \
&& make --jobs="$(nproc)" \
&& make install \
&& cd .. \