Skip to content
Oeiuwq Faith Blog OpenSource Porfolio

tweag/rust-alpine-mimalloc.json
{
"createdAt": "2023-07-24T17:03:09Z",
"defaultBranch": "master",
"description": null,
"fullName": "tweag/rust-alpine-mimalloc",
"homepage": "",
"language": "Shell",
"name": "rust-alpine-mimalloc",
"pushedAt": "2025-06-14T06:25:28Z",
"stargazersCount": 37,
"topics": [],
"updatedAt": "2025-11-10T22:05:28Z",
"url": "https://github.com/tweag/rust-alpine-mimalloc"
}

This Docker image builds upon the alpine:latest image, provides cargo/rustc and replaces the default musl malloc implementation with mimalloc. If you build Rust or C/C++ static executables in this image, the resulting executables will automatically link with mimalloc without needing any special build flags.

Notice: we switched away from rust:alpine and now uses cargo/rust packaged by alpine. Statically linked executables will continue to link against mimalloc as intended, but you need extra command-line arguments to ensure they are indeed static:

Terminal window
$ cargo install --target x86_64-alpine-linux-musl foo

The --target flag is required. The default target is either x86_64-alpine-linux-musl or aarch64-alpine-linux-musl, and can also be extracted from $(rustc -vV | sed -n "s|host: ||p").

Supported & tested archs: amd64 and arm64/v8.

For more details, see this blog post.