I wish to create a build of a project constructed so that it is identical to the release build, except that the debug version of the default allocator is used (with canary checks on alloc/free and so on). The compiler/CRT is Visual Studio 2010.
Reading the documentation for the CRT it seems that _DEBUG needs to be defined for calls to _CrtCheckMemory(), _malloc_dbg(), etc. to not be removed. I do not wish to enable the _DEBUG define since this will influence more than the allocator.
Is there a way to use the CRT debug allocator without having _DEBUG defined?
_malloc_dbg()
requires the debug runtime, the debug runtime requires _DEBUG
- So no, you can't do this.