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:
1 parent
195ad299cd
commit
e685a177d5
3 files changed
+73
-18
No files matched your search
@@ -628,6 +628,25 @@ RUN curl --fail --location --output redis-plus-plus.tar.gz \
|
|||||||
&& cmake --build build --parallel "$(nproc)" --target install \
|
&& cmake --build build --parallel "$(nproc)" --target install \
|
||||||
&& rm -rf build src
|
&& 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 \
|
RUN curl --fail --location --output jemalloc.tar.gz \
|
||||||
https://wangguofang.net/github.com/jemalloc/jemalloc/archive/5.3.1.tar.gz \
|
https://wangguofang.net/github.com/jemalloc/jemalloc/archive/5.3.1.tar.gz \
|
||||||
&& mkdir src \
|
&& mkdir src \
|
||||||
@@ -639,6 +658,8 @@ RUN curl --fail --location --output jemalloc.tar.gz \
|
|||||||
--disable-doc \
|
--disable-doc \
|
||||||
--disable-shared \
|
--disable-shared \
|
||||||
--enable-static \
|
--enable-static \
|
||||||
|
--enable-prof \
|
||||||
|
--enable-prof-libunwind \
|
||||||
&& make --jobs="$(nproc)" \
|
&& make --jobs="$(nproc)" \
|
||||||
&& make install \
|
&& make install \
|
||||||
&& cd .. \
|
&& cd .. \
|
||||||
|
|||||||
@@ -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 \
|
&& cmake --build build --parallel "$(nproc)" --target install \
|
||||||
&& rm -rf build src
|
&& 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 \
|
RUN git clone --branch=5.3.1 --depth=1 https://github.com/jemalloc/jemalloc.git src \
|
||||||
&& cd src \
|
&& cd src \
|
||||||
&& ./autogen.sh \
|
&& ./autogen.sh \
|
||||||
@@ -558,6 +573,8 @@ RUN git clone --branch=5.3.1 --depth=1 https://github.com/jemalloc/jemalloc.git
|
|||||||
--disable-doc \
|
--disable-doc \
|
||||||
--disable-shared \
|
--disable-shared \
|
||||||
--enable-static \
|
--enable-static \
|
||||||
|
--enable-prof \
|
||||||
|
--enable-prof-libunwind \
|
||||||
&& make --jobs="$(nproc)" \
|
&& make --jobs="$(nproc)" \
|
||||||
&& make install \
|
&& make install \
|
||||||
&& cd .. \
|
&& cd .. \
|
||||||
|
|||||||
+35
-18
@@ -29,6 +29,24 @@ RUN dnf install --assumeyes --enablerepo=crb \
|
|||||||
|
|
||||||
RUN git config --global url."https://wangguofang.net/github.com/".insteadOf "https://github.com/"
|
RUN git config --global url."https://wangguofang.net/github.com/".insteadOf "https://github.com/"
|
||||||
|
|
||||||
|
RUN RUSTUP_VERSION=1.28.2 \
|
||||||
|
&& RUST_VERSION=1.98.0 \
|
||||||
|
&& RUST_ARCH="$(uname -m)" \
|
||||||
|
&& case "$RUST_ARCH" in \
|
||||||
|
x86_64) RUSTUP_SHA256=20a06e644b0d9bd2fbdbfd52d42540bdde820ea7df86e92e533c073da0cdd43c ;; \
|
||||||
|
aarch64) RUSTUP_SHA256=e3853c5a252fca15252d07cb23a1bdd9377a8c6f3efa01531109281ae47f841c ;; \
|
||||||
|
*) echo "Unsupported architecture: $RUST_ARCH" >&2; exit 1 ;; \
|
||||||
|
esac \
|
||||||
|
&& curl --fail --location --output rustup-init \
|
||||||
|
"https://static.rust-lang.org/rustup/archive/${RUSTUP_VERSION}/${RUST_ARCH}-unknown-linux-gnu/rustup-init" \
|
||||||
|
&& echo "${RUSTUP_SHA256} rustup-init" | sha256sum --check - \
|
||||||
|
&& chmod +x rustup-init \
|
||||||
|
&& ./rustup-init -y --default-toolchain none \
|
||||||
|
&& "$HOME/.cargo/bin/rustup" --version \
|
||||||
|
&& "$HOME/.cargo/bin/rustup" toolchain install "$RUST_VERSION" --profile minimal \
|
||||||
|
&& ln --symbolic "$HOME"/.cargo/bin/* /usr/local/bin/ \
|
||||||
|
&& rm rustup-init
|
||||||
|
|
||||||
RUN curl --fail --location --output boost.tar.bz2 \
|
RUN curl --fail --location --output boost.tar.bz2 \
|
||||||
https://mirrors.aliyun.com/blfs/conglomeration/boost/boost_1_83_0.tar.bz2 \
|
https://mirrors.aliyun.com/blfs/conglomeration/boost/boost_1_83_0.tar.bz2 \
|
||||||
&& echo "6478edfe2f3305127cffe8caf73ea0176c53769f4bf1585be237eb30798c3b8e boost.tar.bz2" \
|
&& echo "6478edfe2f3305127cffe8caf73ea0176c53769f4bf1585be237eb30798c3b8e boost.tar.bz2" \
|
||||||
@@ -562,6 +580,21 @@ RUN git clone --branch=1.3.15 --depth=1 https://github.com/sewenew/redis-plus-pl
|
|||||||
&& cmake --build build --parallel "$(nproc)" --target install \
|
&& cmake --build build --parallel "$(nproc)" --target install \
|
||||||
&& rm -rf build src
|
&& 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 \
|
RUN git clone --branch=5.3.1 --depth=1 https://github.com/jemalloc/jemalloc.git src \
|
||||||
&& cd src \
|
&& cd src \
|
||||||
&& ./autogen.sh \
|
&& ./autogen.sh \
|
||||||
@@ -569,6 +602,8 @@ RUN git clone --branch=5.3.1 --depth=1 https://github.com/jemalloc/jemalloc.git
|
|||||||
--disable-doc \
|
--disable-doc \
|
||||||
--disable-shared \
|
--disable-shared \
|
||||||
--enable-static \
|
--enable-static \
|
||||||
|
--enable-prof \
|
||||||
|
--enable-prof-libunwind \
|
||||||
&& make --jobs="$(nproc)" \
|
&& make --jobs="$(nproc)" \
|
||||||
&& make install \
|
&& make install \
|
||||||
&& cd .. \
|
&& cd .. \
|
||||||
@@ -588,22 +623,4 @@ RUN curl --fail --location --output libproxyprotocol.tar.gz \
|
|||||||
|
|
||||||
RUN cp --archive /usr/local/lib/. /usr/local/lib64/
|
RUN cp --archive /usr/local/lib/. /usr/local/lib64/
|
||||||
|
|
||||||
RUN RUSTUP_VERSION=1.28.2 \
|
|
||||||
&& RUST_VERSION=1.98.0 \
|
|
||||||
&& RUST_ARCH="$(uname -m)" \
|
|
||||||
&& case "$RUST_ARCH" in \
|
|
||||||
x86_64) RUSTUP_SHA256=20a06e644b0d9bd2fbdbfd52d42540bdde820ea7df86e92e533c073da0cdd43c ;; \
|
|
||||||
aarch64) RUSTUP_SHA256=e3853c5a252fca15252d07cb23a1bdd9377a8c6f3efa01531109281ae47f841c ;; \
|
|
||||||
*) echo "Unsupported architecture: $RUST_ARCH" >&2; exit 1 ;; \
|
|
||||||
esac \
|
|
||||||
&& curl --fail --location --output rustup-init \
|
|
||||||
"https://static.rust-lang.org/rustup/archive/${RUSTUP_VERSION}/${RUST_ARCH}-unknown-linux-gnu/rustup-init" \
|
|
||||||
&& echo "${RUSTUP_SHA256} rustup-init" | sha256sum --check - \
|
|
||||||
&& chmod +x rustup-init \
|
|
||||||
&& ./rustup-init -y --default-toolchain none \
|
|
||||||
&& "$HOME/.cargo/bin/rustup" --version \
|
|
||||||
&& "$HOME/.cargo/bin/rustup" toolchain install "$RUST_VERSION" --profile minimal \
|
|
||||||
&& ln --symbolic "$HOME"/.cargo/bin/* /usr/local/bin/ \
|
|
||||||
&& rm rustup-init
|
|
||||||
|
|
||||||
CMD ["/bin/bash"]
|
CMD ["/bin/bash"]
|
||||||
Reference in new issue
Block a user