microsoft / microsoft/mimalloc
Don't silently ignore MI_OVERRIDE
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 13.4k
- Forks
- 1.2k
- Avg merge
- 4d 45m
- Merged PRs (30d)
- 13
Description
I just noticed that `WIN32` builds will ignore `MI_OVERRIDE` option for static and object builds on windows:
https://github.com/microsoft/mimalloc/blob/0560fc27c08d28d523b7f741a42deb26cd01c0c6/CMakeLists.txt#L403-L411
I propose this be treated as a fatal error, rather than a comment which the user may never see.
So
```cmake
if (WIN32 AND (MI_BUILD_STATIC OR MI_BUILD_OBJECT))
message(FATAL_ERROR "It is only possible to override malloc on Windows when building as a DLL.")
endif()
if (MI_BUILD_STATIC)
target_compile_definitions(mimalloc-static PRIVATE MI_MALLOC_OVERRIDE)
endif()
if (MI_BUILD_OBJECT)
target_compile_definitions(mimalloc-obj PRIVATE MI_MALLOC_OVERRIDE)
endif()
```
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
Start in CMakeLists.txt around lines 403-411 and inspect how MI_OVERRIDE is handled for WIN32 static and object builds. Configure the relevant Windows build options and verify that unsupported overrides fail clearly, while supported DLL builds retain their existing behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, cmake
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100