Josh Posted November 19, 2014 Share Posted November 19, 2014 I want to do some memory testing, but every approach I read about doesn't work. Application verifier uses an enormous amount of memory and makes testing impossible. Including afx.h doesn't work because I've got tons of libraries I use that include windows.h. I can't figure out how to override malloc / free because I just get a ton of errors. Is there another way to do this? Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Josh Posted November 19, 2014 Author Share Posted November 19, 2014 I have been able to improve memory testing with this code: #ifdef DEBUG _CrtSetDbgFlag(_CRTDBG_CHECK_ALWAYS_DF| _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_WNDW); _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_WNDW); #endif Very very slow but it seems to catch memory overwrites I intentionally added for testing. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
randomkeyhits Posted November 19, 2014 Share Posted November 19, 2014 If you want to try this kind of thing under Linux then I recommend Valgrind. Its my go to tool for memory integrity testing. Quote content over form, game play over all. Link to comment Share on other sites More sharing options...
nelsoncs Posted November 19, 2014 Share Posted November 19, 2014 Yes, unfortunately Valgrind is only available for Linux and Unices. It is a fantastic tool and super easy to use. I often make it my first line of debugging info for C++ because so many bugs also cause memory leaks. Probably the only real drawbacks are the slow runtime (unavoidable) and large amount of debug output. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.