
Memory Usage in Rust Services and Finding Leaks Step by Step
Find where a Rust service's memory goes: read RSS and allocator stats, profile allocations with dhat or heaptrack, tell a leak from growth, and fix the usual causes.
Everything you need to level up your coding skills.

Find where a Rust service's memory goes: read RSS and allocator stats, profile allocations with dhat or heaptrack, tell a leak from growth, and fix the usual causes.

cargo-nextest runs each test in its own process with better parallelism, clear output, retries and JUnit reports. See install, speed expectations, config and what it does not run.

Profile guided optimization compiles twice: once to collect a profile from a real workload, once to optimize with it. Do it by hand or with cargo-pgo, and judge the gain.

tracing adds spans and key-value fields to logs, works across async tasks and outputs JSON for log pipelines. Set up tracing-subscriber and instrument a handler.

The log crate is a facade and env_logger is one backend. Set it up, pick levels by RUST_LOG, log with lazy arguments and learn why libraries only depend on log.

A panic prints a message and one line of context. Set RUST_BACKTRACE to see the stack, find your frames in the noise and know what debug symbols change.

Debug embedded Rust with probe-rs: defmt logging over RTT, panic-probe, breakpoints in VS Code, reading hard faults and what to check when nothing prints.

Program an STM32 in Rust with probe-rs: pick the target, create a project from the cortex-m template, use embassy-stm32 or a PAC and HAL, flash, log and debug.

Build a git hook manager in Rust: read a hooks config, install shims into .git/hooks, run commands on staged files in order, and report results with proper exit codes.

Add structured logs and a request id to every Axum request with tower-http TraceLayer, SetRequestIdLayer and tracing spans that carry the id into your code.

Set rustc and Clippy lint levels in the [lints] table of Cargo.toml, inherit them across a workspace with workspace.lints and handle priority for groups.

Seven changes that cut Cargo build time: check instead of build, a faster linker, dependency debug settings, incremental, workspace splits, sccache and feature trimming.
We send one email when a new post is published. No spam.