Crashes in `_mi_page_free_collect`
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start by comparing the _mi_page_free_collect paths in src/page.c for v3.3.2 and src/alloc/page.c for v3.6.1, then inspect the allocator state at the reported crash locations. The report has no reproducer, so first try to narrow down a reproducible case on Rust and Windows; done means identifying the cause and a way to verify a fix.
Written by the indexing model from the issue text.
Description
When using mimalloc in Rust on Windows, we've been experiencing rare crashes (1 out of 2000 runs approximately). We did not find a repro case yet.
We first noticed the issue in v3.3.2, then bumped from the no-longer-maintained mimalloc crate to the new in-repo bindings in v3.6.1, but the crashes still occur.
We've been hunting for a possible FFI mishap / wrong memory handling in the rest of the app but did not find anything yet so we're submitting this issue to collect feedback.
The problem seems similar to https://github.com/microsoft/mimalloc/issues/1098.
We've also tried compiling with MI_DEBUG=2 MI_SECURE=4 and running with GFlags "standard heap verification".
Partial backtrace using `v3.3.2`
This one points to https://github.com/microsoft/mimalloc/blob/v3.3.2/src/page.c#L178
0x172872a _mi_page_free_collect(mi_page_s*, bool)+54 C:\project\vendor\libmimalloc-sys\c_src\mimalloc\v3\src\page.c:210
0x173313e mi_page_queue_find_free_ex(mi_theap_s*, mi_page_queue_s*, bool)+9 C:\project\vendor\libmimalloc-sys\c_src\mimalloc\v3\src\page.c:765
0x172708f _mi_malloc_generic(mi_theap_s*, unsigned long long, unsigned long long, unsigned long long*)+13 C:\project\vendor\libmimalloc-sys\c_src\mimalloc\v3\src\page.c:1012
0x1735109 mi_theap_realloc_aligned(mi_theap_s*, void*, unsigned long long, unsigned long long)+231 C:\project\vendor\libmimalloc-sys\c_src\mimalloc\v3\src\alloc-aligned.c:368
0x17385ca alloc::raw_vec::RawVecInner<alloc::alloc::Global>::finish_grow<alloc::alloc::Global>(unsigned long long, core::alloc::layout::Layout)+13 C:\Users\user\.rustup\toolchains\nightly-2026-05-19-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\alloc\src\raw_vec\mod.rs:556
0x173c47f alloc::raw_vec::RawVec<backtrace::capture::BacktraceFrame,alloc::alloc::Global>::grow_one<backtrace::capture::BacktraceFrame,alloc::alloc::Global>()+54 C:\Users\user\.rustup\toolchains\nightly-2026-05-19-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\alloc\src\raw_vec\mod.rs:188
0x163c2f hickory_proto::rr::domain::name::Name::trim_to(unsigned long long)+723 C:\project\vendor\hickory-proto\src\rr\domain\name.rs:370
// snip
Partial backtrace using `v3.6.1`
Points to https://github.com/microsoft/mimalloc/blob/v3.6.1/src/alloc/page.c#L361
0x177e934 _mi_page_free_collect(mi_page_s*, bool)+48 C:\project\vendor\mimalloc-sys\mimalloc\src\alloc\page.c:384
0x178c990 mi_page_queue_find_free_ex(mi_theap_s*, mi_page_queue_s*, bool)+9 C:\project\vendor\mimalloc-sys\mimalloc\src\alloc\alloc-generic.c:74
0x178c8da mi_page_queue_find_free(mi_theap_s*, mi_page_queue_s*)+7 C:\project\vendor\mimalloc-sys\mimalloc\src\alloc\alloc-generic.c:211
0x177ccbb _mi_malloc_generic(mi_theap_s*, unsigned long long, unsigned long long, mi_page_s**)+10 C:\project\vendor\mimalloc-sys\mimalloc\src\alloc\alloc-generic.c:494
0x162184a tracing_appender::non_blocking::impl$3::write(tracing_appender::non_blocking::NonBlocking*, ref$<slice2$<u8> >)+23 C:\project\vendor\tracing-appender\src\non_blocking.rs:242
// snip
- Dominant language
- C
- Stars
- 13.6k
- Forks
- 1.2k
- Avg merge
- 18h 12m
- Merged PRs (30d)
- 20
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/mimalloc
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Building mimalloc with `-Wundef` compiler flag logs many warnings on undefined macrosPossibly taken @vstinner claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
microsoft/mimalloc#1506 · 5 comments ·
Maintainers usually reply within 1 day
-
stale
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
microsoft/mimalloc#1113 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
microsoft/mimalloc#886 · 4 comments · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
microsoft/mimalloc#368 · 1 comment ·
Maintainers usually reply within 1 day
All issues in microsoft/mimalloc
Similar issues
-
needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
389ds/389-ds-base#8157 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
coolsnowwolf/lede#14305 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Needs-Triage
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 2 days