How to test if there are any memory leaks from a program?
I''ve completed the graphic side of a dx wrapper, and i just want to make sure i havent left any memory leaks.
How would i test this?
(also if possibly there is anyway to tell anything left that needs to be cleaned up, eg pointers etc)
For memory leaks of DirectX. If I didnot forget link with d3dx8dt.lib and d3d8.lib. After exit from program in Visual C++ output screen it showns memory leaks. Not only for memory leaks all errors and warnings are output. If you are not using VC in utilities directory run dbmon.exe. the outputs will be shown there.
(Also for DX9 add dt suffix to lib filename)
For C++ memory leaks
define
At the end of the program call the below.
SET_CRT_DEBUG_FIELD( _CRTDBG_LEAK_CHECK_DF );
I''ve took it from MSDN tested and works welll
(Also for DX9 add dt suffix to lib filename)
For C++ memory leaks
define
// The following macros set and clear, respectively, given bits// of the C runtime library debug flag, as specified by a bitmask.#ifdef _DEBUG#define SET_CRT_DEBUG_FIELD(a) \ _CrtSetDbgFlag((a) | _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG))#define CLEAR_CRT_DEBUG_FIELD(a) \ _CrtSetDbgFlag(~(a) & _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG))#else#define SET_CRT_DEBUG_FIELD(a) ((void) 0)#define CLEAR_CRT_DEBUG_FIELD(a) ((void) 0)#endif
At the end of the program call the below.
SET_CRT_DEBUG_FIELD( _CRTDBG_LEAK_CHECK_DF );
I''ve took it from MSDN tested and works welll
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement