Skip to content

fix: enable unprefixed jemalloc to override musl malloc for SQLite C code #9

fix: enable unprefixed jemalloc to override musl malloc for SQLite C code

fix: enable unprefixed jemalloc to override musl malloc for SQLite C code #9

name: "[TEMP] Validate jemalloc fix"
on:
push:
branches: ["*"]
pull_request:
branches: [main]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
musl-jemalloc:
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- target: aarch64-unknown-linux-musl
runner: ubuntu-22.04-arm
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/[email protected]
with:
targets: ${{ matrix.target }}
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
shared-key: ${{ matrix.target }}
- name: Install MUSL tools
run: sudo apt-get update && sudo apt-get install -y musl-tools
- name: Build, test, and verify jemalloc
run: |
echo "=== Build with jemalloc ==="
cargo build --target ${{ matrix.target }} --features jemalloc
echo "=== Test with jemalloc ==="
cargo test --workspace --target ${{ matrix.target }} --features jemalloc
echo "=== Verify jemalloc overrides system malloc ==="
BINARY="target/${{ matrix.target }}/debug/stakpak"
if nm "$BINARY" 2>/dev/null | grep -q " W malloc$"; then
echo "FAIL: malloc is weak (W) β€” musl allocator active, jemalloc NOT overriding"
exit 1
fi
echo "OK: jemalloc overrides system malloc"
echo "=== Build release binary ==="
cargo build --release --target ${{ matrix.target }} --features jemalloc
RELEASE_BINARY="target/${{ matrix.target }}/release/stakpak"
echo "Release binary size: $(du -h "$RELEASE_BINARY" | cut -f1)"
if nm "$RELEASE_BINARY" 2>/dev/null | grep -q " W malloc$"; then
echo "FAIL: release binary still uses musl malloc"
exit 1
fi
echo "OK: release binary also uses jemalloc"