I\'m trying to figure out a way to globally override malloc and related functions in visual c++ (2005). My setup is a dll with statically linked runtime library that consist
Remove all of the .obj files that contain memory management functions from the runtime libraries using the LIB tool, then use the "Ignore default libraries" option in the IDE and manually specify "your" runtime library instead. Then compile; you should get a few linker errors about undefined malloc and free and so on. This is where you come in!
(You'll probably also want to do something similar to the C++ libraries if you use them, though I think the default operator news call malloc so you might be good to go straight away.)
The Visual Studio install comes with the runtime source code (look in vc/crt/src in your Visual Studio install folder), so finding the full set of memory management functions is fairly straightforward. I don't have exact details to hand (previous employer...) but as I recall, it only took about half a day to sort out even though there were rather more memory allocation functions than I expected.