microsoft / microsoft/mimalloc
Windows crash on exit v2.0
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 13.4k
- Forks
- 1.2k
- Avg merge
- 4d 45m
- Merged PRs (30d)
- 13
Description
Hello,
Building in any configuration on Windows vs2019, MI_USE_RTLGENRANDOM and not using overrides, calling mi_malloc and mi_free will work but upon exit it asserts:
> mimalloc: assertion failed: at "C:\Users\Max\AppData\Local\.xmake\cache\packages\2102\m\mimalloc\2.0.0\source\mimalloc-2.0.0\src\init.c":268, _mi_heap_done
assertion: "heap->tld->segments.count == 0 || heap->thread_id != _mi_thread_id()"
Here is the full stack:
> Tests.exe!abort() Line 77 C++
Tests.exe!_mi_assert_fail(char const *,char const *,unsigned int,char const *) C++
Tests.exe!mi_register_deferred_free() C++
Tests.exe!_mi_preloading(void) C++
ntdll.dll!00007ff931d14075() Unknown
ntdll.dll!00007ff931ce5898() Unknown
ntdll.dll!00007ff931cfd2ae() Unknown
KernelBase.dll!00007ff92f61772a() Unknown
kernel32.dll!00007ff930e7103b() Unknown
Tests.exe!common_end_thread(const unsigned int return_code) Line 262 C++
Tests.exe!_endthreadex(unsigned int return_code) Line 277 C++
Tests.exe!thread_start(void * const parameter) Line 97 C++
kernel32.dll!00007ff930e67034() Unknown
ntdll.dll!00007ff931cfd241() Unknown
This does not occur with either 1.6.7 or 1.7.0.
Contributor guide
No contributing guide indexed for this repository
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.
Research direction
Reproduce the Windows VS2019 exit crash with MI_USE_RTLGENRANDOM, no overrides, and a mi_malloc/mi_free pair. Start at src/init.c:268 and trace _mi_heap_done through the reported thread-exit stack; compare behavior with mimalloc 1.6.7 and 1.7.0. Done means the same scenario exits without the assertion.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100