All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
This is the shared changelog for rustfs-mimalloc-sys, rustfs-mimalloc,
and rustfs-mimalloc-profiling, which share one release version.
cb534580 against upstream on November
22: the main3 tip is three README-only commits past the pin, no v3.7.1
release exists, and the 43 dev3 commits (PRs #1501, #1502, #1506, #1509,
#1510 plus CPython-linked fixes for eager page revival, atomic free-list
links and force-collected abandoned pages during visits) change no exported
declaration — the public-header delta is compiler-macro hardening and the
documented mi_option_allow_thp value-2 semantics. All guarded build
anchors (QSBR correction, MI_PROFILE=0 sampler, Windows static CRT) still
apply unchanged.cc 1.11.3, regex 1.13.2,
toml 1.2.2 plus transitive lockfile patches (hashbrown 0.17.2 in the
November 22 refresh). No semver-incompatible upgrades were available; the
published allocator graphs are unaffected (validated across the full
workspace suite, API/ABI projection and the isolated provider workspaces).SamplingAllocator’s GlobalAlloc
methods, the allocator-seen marker and the sampler countdown now inline into
caller allocation sites, interval expiry and sample capture moved to a cold
non-inlined tail, the deallocation live-table removal drops its redundant
recursion-suppression guard (live::remove never allocates, captures or
records), and stack capture happens before taking the TLS sample ring lock
so a concurrent report drain no longer waits for the unwinder.StackKey carries a capture-time hash of its
captured prefix, so aggregating large drains hashes one u64 per sample
instead of every captured frame, and Linux ELF segment file offsets are
cached per image identity across reports instead of re-opening and
re-parsing each involved binary on every report.cb534580,
including lazy abandoned-bin bitmap initialization, corrected THP advice
eligibility and huge-block purge/reset fixes. Numeric C version is 30700;
v3.7.0 is the latest official upstream release.mi_register_deferred_free, mi_register_output,
mi_register_error) is now concurrent-safe upstream; signatures are
unchanged but re-registration may briefly route other threads to the
previously registered callback, which raw-API consumers must tolerate.MI_SECURE_ENV=1 for secure builds, restricting environment options
to show_stats, verbose and allow_thp, with programmatic option APIs available.
Document target-CFLAGS controls and automatic native profiler restrictions.rustfs_mimalloc::pprof::PprofProfiler over the native pprof
profiler (mi_pprof_profiler_new/start/stop/snapshot/delete):
C-side sampled pprof snapshots at a fraction of the Rust unwinder cost,
with PprofConfig (Poisson threshold and periodic snapshot intervals,
zero disables) and drop ordering that stops sampling and detaches before
deleting. Attachment is unsafe and requires callback quiescence before
Drop. Covered by a dedicated integration test binary.rustfs_mimalloc::callback
module and crate-root re-exports: register_error/clear_error,
register_output/clear_output and
register_deferred_free/clear_deferred_free accept &'static closures
instead of bare function pointer plus arg pairs. The trampolines keep the
registration lock alive for the whole C call so re-registration can never
race an in-flight invocation, contain panics with a loud abort instead of
unwinding into C, and route concurrent calls correctly under upstream’s
v3.7.0 re-registration semantics. Registration entry points detect and
refuse re-entrant calls from inside a callback (a clear panic-turned-abort
instead of a registration-lock deadlock) with a dedicated regression test.mi_option_large_os_pages, mi_option_eager_region_commit,
mi_option_reset_decommits, mi_option_reset_delay,
mi_option_limit_os_alloc) as aliases beside the existing
mi_option_minimal_purge_size, completing C-side option-name portability.mi_{malloc,zalloc,calloc,realloc,rezalloc,recalloc}_aligned_at
global and heap variants), the subprocess lifecycle and heap visiting
(mi_subproc_{main,current,new,destroy,add_current_thread,visit_heaps}),
and the heap block visitors (mi_heap_visit_blocks,
mi_heap_visit_abandoned_blocks, mi_theap_visit_blocks), completing the
previously unreachable mi_subproc_profile and mi_block_visit_fun FFI.
The safe Heap wrapper gains the matching *_aligned_at methods; cached
ThreadHeap contexts use the same entry points through their parent heap.
Binding inventory grows to 159 bound functions and 150 FFI signatures.MiMalloc: ordinary allocation,
zeroed allocation and reallocation route to the native mi_malloc,
mi_zalloc and mi_realloc entry points when the layout fits mimalloc’s
native guarantees (alignment within MI_MAX_ALIGN_SIZE and at least the
requested size), mirroring upstream’s own guards. The aligned APIs remain
for genuinely over-aligned layouts, which previously also paid an extra
call chain on every allocation.dealloc: route through mi_free_size_aligned
so small frees take mimalloc’s page-metadata fast path and over-aligned
small frees degrade safely to plain mi_free.GlobalAlloc path improved 13–23% for layouts up to 1 KiB
(p < 0.05, two independent runs), 2–8% at 4–64 KiB, with one mid-size
point inside noise. Unchanged helper microbenchmarks moved within
code-layout variance; treat cross-build deltas below ~10% with caution.Heap::visit_blocks / Heap::visit_abandoned_blocks and
ThreadHeap::visit_blocks accept a BlockVisitor closure (page area,
optional live block pointer, block size; return false to stop) instead
of a bare mi_block_visit_fun plus *mut c_void arg. The trampoline
keeps the caller state alive for the walk and contains panics with a
loud abort instead of unwinding into C. Area-level visits report
block == None per the upstream convention. The quiescence requirement
(no concurrent allocation into or free from the heap during the walk)
keeps the entry points unsafe.ThreadHeap::merge_stats_to_parent() over
mi_theap_stats_merge_to_heap, making long-lived cached worker contexts
visible in Heap::stats_json() / Heap::stats_print() without waiting
for thread exit or collection.PprofProfiler::attach_subproc over mi_subproc_profile, extending the
native profiler to custom subprocesses created through
mi_subproc_new and completing the reachability of the subprocess
profiler FFI. The profiling crate’s documentation now explains when to
choose it versus the native pprof path (rustfs_mimalloc::pprof) and
the heap-ABBA harness documents that its A/B contrast is the workload,
not a build difference.mi_thread_heap_release and unsafe Heap::release_current_thread().
Workers can release contexts before heap deletion while live blocks remain
valid for frees. Further allocations from that heap on the releasing thread
return null. Cached thread-heap aliases must be discarded before release.mi_option_deprecated_unsafe_guarded_precise at ID 31, preserving older Rust
spellings. Precise placement uses the native MI_UNSAFE_GUARDED_PRECISE build
control and requires alignment-contract care.HeapArea::used
documentation — upstream reports a live-block count, not bytes; document
the heap-visit closure deadlock constraint (upstream holds the heap’s
context lock for the whole walk, so Heap::thread_local, delete,
destroy or a nested visit of the same heap from inside the closure hangs);
restore the native callback handler before clearing the Rust registration
in clear_error/clear_output/clear_deferred_free so no message falls
into a handlerless window; record the current session generation after a
stale-generation ring clear during TLS flushes; stop charging
dropped_samples on registry-lock contention (drains defer, nothing is
lost); and strengthen the pprof ownership test to prove a failed retarget
preserves the profiler’s main attachment.mi_subproc_visit_heaps and mi_theap_visit_blocks dereference their
visitor unconditionally (unlike mi_heap_visit_blocks, None crashes),
move the pprof profiler state-machine test out of the lib test binary so
its profiler drop honors the callback-quiescence contract under parallel
test runs, and refresh the one stale native pin reference in the overview.PprofProfiler state and contract documentation: attaching stops a
running profiler (the wrapper flag now mirrors that), sampling resumes via
start alone after stop, and base_file_name documents native extension
stripping plus the 1024-byte truncation. mi_profiler_start’s return value
(already-running flag, not success) is documented on the sys declaration,
and the free_small_local comment now states upstream’s actual null
handling. The xtask option-drift check no longer lets a renamed C option
hide behind a shared numeric ID: a matching name or explicit alias is
required, with a mutation test covering the legacy-alias rename case.test-providers defaults to
the local working tree (--registry-dependencies opts out; the resolved
source is printed), the crates.io sparse-index shard is computed from the
crate name instead of the hardcoded ru/st path, the ABI projection pins
every layout field’s effective type through C11 _Generic (a same-size
integer/pointer swap now fails, with a new mutation control), live-table
contention drops are charged to their own session, and poisoned
recorded-shard locks are recovered instead of silently skipped. CI now
runs the test suite with the debug_in_debug feature on Ubuntu and
Windows.record_sample skips the unwinder for events whose
session already ended and drops a behaviorally dead ring branch; the
redundant pre-tail TLS store in the sampler hot path is gone; the sys
crate documents its uniform safety policy at the crate level with formal
# Safety sections on the heap lifecycle and sized/aligned free entry
points, mi_wsize_from_size documents its intentional overflow
difference from the C macro, and the pprof module documents the
per-subprocess native attach slots. Provider tests regenerate the isolated
consumer lockfile on every run, criterion estimate parsing tolerates
thousands separators, and a dispatched dry run without a matching git
tag prints a note instead of surfacing the gap at publish time.no_profile when the latest upstream sampler is explicitly enabled
through raw profiler APIs. Generate a source-checked MI_PROFILE=0 correction
that forces the sample rate to zero and excludes enabled-profiler lookup,
while retaining explicit snapshots and guarded allocation checks.MI_MALLOC_VERSION 30602 → 30700 and a callback
re-registration note; internal headers refactored page-map, bitmap and
option-state plumbing without ABI impact. Recheck merged PRs #1471–#1500:
no new exported APIs to bind.REVIEW_0.7.5.md and UPSTREAM_REVIEW.md.ea136f74, 161
commits after the previous v3.6.1 release pin. Numeric version is 30602;
upstream’s latest official release at review time remains v3.6.1.secure; default native MTE/PAC remain disabled. Document
numeric target-CFLAGS controls and hardware/OS requirements; no speedup claim.last_report_elapsed_micros() and the overhead example’s
last_report_elapsed_us output cover the complete report path, including
aggregation, symbolization and temporary cleanup.Error::MetadataAllocationFailed reports session queue/live-table reservation
failures and supports retrying with smaller capacities.mi_theap_realloc_aligned / mi_theap_rezalloc_aligned and unsafe
ThreadHeap::realloc_aligned / rezalloc_aligned, following upstream PR
#1477. Cached per-worker contexts support aligned buffer growth without
another heap TLS lookup. Zeroed reallocation requires original zero
initialization; failed reallocation preserves the original block.mi_option_mte at ID 54, available through the existing option APIs. This
runtime control is effective only in a native MTE build on supported systems;
it does not turn on MTE in default Cargo builds.Profiler::stop and Drop, after synchronizing registered TLS handoffs.Heap::thread_local and raw lookup documentation: upstream never
returns null and can return an empty, unavailable context. Some does not
imply allocation readiness. Deprecated upstream options have no effect in v3.ea136f74. The previous
source commit 475aac0 passes all 48 CI jobs, including Windows static CRT,
clang-cl, Linux/musl, macOS and Rust 1.95 compatibility.UPSTREAM_REVIEW.md and REVIEW_0.7.4.md for results, optimization
priorities and target/hardware validation limits.56dc5eb8 (numeric version
30601), 25 commits after the previous validated development pin. The vendor
source remains pristine; post-release 3.6.2/MTE development is excluded.secure feature continues
to select MI_SECURE=4. Inherit Windows image-memory guard handling, static
override strdup fixes, and atomic native error-handler storage.0); configure before heap creation to allow all contexts (1) or disable
reclaim on free (-1). The numeric option ID is unchanged.Raw C23 mi_free_sized and mi_free_aligned_sized bindings, plus unsafe
MiMalloc::free_sized / free_aligned_sized wrappers. The C23 aligned form
takes alignment before size; both must match the original allocation.
GlobalAlloc’s forwarding behavior is unchanged.
rustfs-mimalloc-profiling/no_hooks compiles out allocation observation in
optimized builds and rejects sessions with InvalidConfig. Default behavior
is preserved. Feature unification applies the opt-out to the full dependency
graph, so it should be selected by the application._Unwind_Backtrace as native pprof’s compiler-unwinder fallback,
avoiding the missing LLVM unw_backtrace symbol (#1454). Native Cargo musl
backtrace configuration remains opt-in.UPSTREAM_REVIEW.md
and REVIEW_0.7.3_2026-11-02.md.b18ab4ee, 16 commits
after the 0.7.1 development snapshot. Numeric version 30600 is unchanged.MI_ARENA_PURGE_ON_FREE=1 CFLAGS opt-in, which processes
expired purges during arena free. Keep it disabled by default pending workload
RSS and latency measurements.mi_arena_area and mi_arena_contains bindings, plus ArenaId::area and
ArenaId::contains queries. Reserved regions include allocator metadata and
possibly uncommitted pages; membership grants no allocation access rights.no_thp source-generation workaround now fixed
by upstream PR #1445. Compile native parser/PMD/advice probes against the
unmodified source with four macro combinations and a dangling-else negative
control; no longer suppress sign-compare diagnostics after PR #1447.cc 1.9.0
and find-msvc-tools 0.1.15; the test-only crc32fast lock entry is 1.5.3.b5d94fe8, 54 commits after
6f45cc52. The numeric version remains 30600; the latest published upstream
release remains v3.5.3. This pass includes nine merged PRs, detailed in
UPSTREAM_REVIEW.md.K/KiB scaling. Native profiling defaults are
now actually 512 KiB per sample and 1 GiB per allocation snapshot interval;
these are runtime-value fixes, not just comment corrections. Option IDs stay
unchanged; hexadecimal integers work and zero-padded decimals remain invalid.MADV_NOHUGEPAGE, independent of positive-advice alignment
eligibility. Shorter mappings do not receive that negative advice.mi_option_page_full_retain; delayed empty abandoned
pages remain discoverable and can join a receiving same-heap context. Fresh
allocation retries when reclaim releases an empty page. Reclaim-on-free policy
is captured at heap creation; late TLS frees require runtime exclusion.mi_heap_new_qsbr FFI. Ordinary builds return null/ENOSYS;
enabled builds need host C metadata and reader/grace-period hooks. There is no
Cargo QSBR feature or owning safe Rust heap for this mode.mi_option_unsafe_guarded_precise at ID 31 while retaining the old Rust enum
variant and glob imports. API/ABI gates cover 131 Rust function names, 45 option
IDs, 122 extern signatures, nine callbacks and three public C layouts.no_profile checks.MI_NO_CXX_NEW_HANDLER and MI_NO_ALIGN_FALLBACK_WARNING
compile-time controls through target CFLAGS; default behavior is preserved.on_alloc, preserve sampling state on
no-sample paths and avoid an oversized shift in exponential sampling.no_thp conditional compatibility, guarded against source drift.rustfs-mimalloc-profiling): the default profiling core no
longer selects an allocator. Install SamplingAllocator<A> around the
application’s GlobalAlloc provider. Both mimalloc::MiMalloc and
rustfs_mimalloc::MiMalloc use the same recorder and pprof implementation.SamplingMiMalloc::new() and Default convenience API
behind the explicit rustfs-allocator feature. Library adapters can depend
on the core with default-features = false.Keep all three crate versions synchronized at 0.7.0 and refresh the locked libc resolution to 0.2.191. The pinned native allocator and ABI are unchanged.
workspace.dependencies; member crates inherit them while retaining their
feature selections and target-platform conditions.libflate requirement from 2.1 to
2.3 and refresh the workspace lockfile, including prost-derive’s
itertools 0.14 resolution.repr(C) layouts, complementing the
function-name/option-ID inventory and runtime linkage tests. Negative
controls reject return-type, callback-constness, layout-order and size-alias
drift. CI runs the checks without adding allocator runtime overhead.dev3 remains 6f45cc52; no new upstream API requires another
source or binding update in this pass.dev3 commit 6f45cc52 (2026-10-16 review), after the
v3.5.4 interim tag. The C source version remains 30504. This includes
allocation/free improvements, adaptive full-page retention, cross-thread page
reclamation, the arena/bitmap source reorganization, and bitmap rollback
fixes through the 2026-10-16 review. Includes naturally aligned allocation
size-class improvements, cache offsets, OS-page heap lifecycle/visiting fixes,
and quiescent fork support. The large-range immediate-purge default is 32 MiB.
Workload-specific throughput and RSS still require measurement.on_snapshot and use
mutable heap pointers in allocation/free callbacks.rust-version from the workspace and member manifests as requested;
retain Rust 1.96.0 as an explicit CI compatibility check, not a Cargo MSRV.rustfs-mimalloc-profiling companion crate, extracted
from grafana/pyroscope-rs#572. It owns the sampling allocator, bounded event
recorder, opt-in live allocation tracking, symbol/mapping resolution and
pprof encoder. Profiler provides an exclusive recording session with explicit
stop and Drop cleanup, returning owned profile bytes without an uploader or
dependency on Pyroscope. The wrapper uses the matching allocator’s
GlobalAlloc interface; direct native allocations are outside its coverage
and bounded recorder pressure can omit samples.Move allocator behavior, optimized profile quality, stress and benchmark validation alongside the profiling implementation. Keep the base allocator dependency graph free of profiling dependencies.
mi_thread_id_of,
mi_heap_set_debug_fill_preserve, mi_theap_delete, and
mi_theap_quiescent_abandon. Added MiMalloc::thread_id_of,
Heap::set_debug_fill_preserve, and unsafe ThreadHeap::quiescent_abandon.
Context deletion remains raw FFI because it invalidates all cached aliases.CFLAGS=-DMI_TRACK_CUSTOM, with no default hot-path overhead.MiMalloc::{expand,rezalloc,rezalloc_aligned}, heap zero-allocation
and reallocation helpers, and cached ThreadHeap::{calloc,malloc_csize,
zalloc_csize,realloc,rezalloc}. Added 13 previously unbound public C
allocation APIs; zero-growth, alignment and overflow behavior are tested.no_profile builds to remove allocation profiling sampling and automatic
MIMALLOC_PROFILE startup. Statistics, alignment, security/debug checks and raw
profiler control ABI remain available; explicit snapshots have no allocation samples.MiMalloc::profiling_enabled() and MI_PROFILE_ENABLED capability queries that
respect the linked sys crate’s unified Cargo features.Heap::thread_local() and borrowed ThreadHeap allocation methods to avoid
repeated TLS lookups when a worker alternates between heaps. The view cannot
outlive its parent or be sent/shared across threads; allocations may still be
freed on other threads. Global allocator and retention defaults are unchanged.mi_register_error, mi_register_output, and
mi_register_deferred_free, with lifetime/concurrency contracts.mi_profiler_snapshot, mi_pprof_profiler_new, and
mi_pprof_profiler_delete; all four profiling interval/sample-rate options.mi_arenas_purge and safe MiMalloc::arenas_purge() to process pending
arena purges in the main subprocess. Expose mi_option_stats_merge_threshold
and mi_option_arena_purge_immediate_size, plus renamed purge/stat-merge
options and compatibility aliases for the prior Rust option names.MiMalloc::free_small_local{,_nonnull} and matching raw FFI. The
allocation’s small page must still be owned by the calling thread.System and
the generic/local small-free paths.Replace interval-crossing loops and their deterministic fallback with one memoryless sampling step. Keep the unsampled path to a TLS countdown and use a FIFO TLS ring so partial drains do not move retained stacks.
Inherit upstream Windows console detachment, ProcessPrng/legacy RNG loading, naturally aligned allocation, direct-OS-page cleanup, and inline-linkage fixes. Upstream #1428 adds array-reallocation contract tests.
src/theap.c to src/heap/theap.c.__ImageBase with explicit extern in C builds. Upstream’s
C++ linkage macro expands to nothing in C and accidentally defined BSS storage,
shadowing the linker-owned PE base. Static UCRT used that false base for RVA
lookups and crashed in __acrt_tls2_supported before main. Verify the symbol
matches the OS module handle and the PE header in the isolated startup test.mi_malloc_size and
mi_malloc_usable_size available even without malloc override; test their
actual linkage and values.mi_free_size size-mismatch checks, Windows
forced-exit handling and UWP compilation, Android syscall avoidance, and
profiling-disabled builds. Keep the built-in pprof implementation enabled in
no_profile so explicit raw snapshots remain functional..CRT$XCT, after UCRT initialization. Keep
weak seeds for early allocation bootstrap and TLS thread-exit cleanup.+crt-static from -crt-static and honor encoded Rust flags.main in an isolated regression
executable, including secure/debug/no-profile and release CI coverage.MI_MALLOC_OVERRIDE on non-Windows override builds.MI_DEFAULT_ALLOW_THP=0 with no_thp; disabling only explicit huge-page
advice did not disable the runtime THP policy or its larger purge granularity.MI_MALLOC_VERSION, preventing stale C objects after submodule updates.profile_disabled=true into new thread heaps without
clearing it. Dedicated-heap and worker-thread profiling can remain inactive.
Profiling stays experimental raw FFI; the integration test proves main-heap
sampling in an isolated single-threaded process only.crt-static target feature for MSVC builds instead of forcing
/MD, allowing a Windows binary and the vendored mimalloc library to use the
same static CRT (/MT) without a runtime DLL dependency.-C target-feature=+crt-static.d4881d3).30503.mi_free_csize_aligned{,_nonnull} FFI mirrors and MiMalloc methods.mi_theap_alloc_new, mi_theap_alloc_new_n, and
mi_theap_alloc_new_nothrow FFI. These retain their upstream C++ OOM-handler
semantics and intentionally have no safe Rust wrapper.636510a).30502.mi_wmalloc_small, mi_wzalloc_small, mi_wsize_from_size,
mi_malloc_csize, mi_zalloc_csize, mi_theap_wmalloc_small,
mi_theap_wzalloc_small, mi_theap_malloc_csize, and
mi_theap_zalloc_csize.MiMalloc wrappers for constant-size and word-size small
allocation fast paths.mi_option_collect_merges_stats and
mi_theap_stats_merge_to_heap through rustfs-mimalloc-sys.rustfs-mimalloc-sys
as raw FFI only.x86_64-pc-windows-gnullvm.CARGO_CFG_TARGET_* values to keep OS, ABI, architecture, and vendor checks
distinct.34fbd7e).30501.mi_free_small_nonnull binding.mi_free_csize and mi_free_csize_nonnull.MiMalloc wrappers for small and constant-size free fast paths.mi_thread_set_in_threadpool() through rustfs-mimalloc-sys and added a safe rustfs_mimalloc::set_current_thread_in_threadpool() wrapper.c_src/mimalloc/src/static.c.microsoft/mimalloc).cd69707).git fetch + git checkout in submodule directory.codeql-action to major version v4 in CI workflow.homepage and documentation fields to all Cargo.toml packages.README.md to rustfs-mimalloc-sys and rustfs-mimalloc sub-crates.readme field to sub-crate Cargo.toml files for crates.io display.win_direct_tls feature (unused in build.rs and source code).README.md to rustfs-mimalloc-sys and rustfs-mimalloc sub-crates.readme field to both sub-crate Cargo.toml files.extended feature and fine-grained secure_level_1..5 aliases.nightly_allocator_api feature so the crate remains fully verifiable on stable Rust.secure as the single heap-encryption feature and mapped it directly to mimalloc’s upstream default MI_SECURE=4.core::ffi platform C types.Heap::main() and Heap::heap_of() do not delete heaps they do not own.win_direct_tls feature (unused in build.rs and source code).extended feature; all stats/options/heap APIs are always available.nightly_allocator_api feature.secure_level_1..5 fine-grained features.rustfs-mimalloc-sys: low-level FFI crate that builds and links mimalloc V3 (v3.5.0).rustfs-mimalloc: safe global allocator wrapper implementing GlobalAlloc.MiMalloc::process_info(), MiMalloc::stats_json(), MiMalloc::stats_print(), MiMalloc::process_info_print(), MiMalloc::stats_reset().MiMalloc::option_set(), option_get(), option_enable(), option_disable().secure, debug, debug_in_debug, override, local_dynamic_tls, no_thp.