Closed gvanem closed 4 months ago
When you include crtdbg.h
then the CRT tries to override all allocation calls to insert its own tracking. You have to pick which one you want to override -- either the CRT standard allocator, or use mimalloc -- you cannot use both at the same time.
Hope this helps.
you cannot use both at the same time.
That was not so obvious when I saw this in types.h
:
#if !defined(MI_DEBUG)
#if !defined(NDEBUG) || defined(_DEBUG)
#define MI_DEBUG 2
#else
#define MI_DEBUG 0
#endif
#endif
This defined(_DEBUG)
made me think mimalloc supported -MDd
too.
ah, of course you can use mimalloc with debug builds -- you just should not include <crtdbg.h>
together with mimalloc-override.h
as that is a header file that specifically overrides calls to malloc
etc using #define
s to call specific CRT allocation functions (just like mimalloc tries to do with mimalloc-override.h
.
Then it seems difficult to use mimalloc to help me find leaks; no filename / line numbers.
Just as well stick to ASAN and/or _DEBUG
-mode. Closing.
I just discovered this package and tried it on a project.
Works fine with MSVC's
cl
andclang-cl
in-MD
(_RELEASE
-mode). But in-MDd
(_DEBUG
-mode) and a#include <crtdbg.h>
ahead of#include <mimalloc/mimalloc-override.h>
spits out a tons of warnings like these (fromclang-cl -W4 -MDd
):To squelch all this noise I have to do:
in my
-FI./config.h
file.So how are we supposed to use
_DEBUG
-mode with mimalloc? Should<crtdbg.h>
be aftermimalloc-override.h
? And I see no test for_INC_CRTDBG
.Is combination not tested/supported? Works fine AFAICS in
_DEBUG
too.BTW, I'm on Win-10, x64 and use the amalgamation of mimalloc; I.e.
static.c
.