Using the Debug Heap 
Author Message
 Using the Debug Heap


I've been wandering the documentation trail through the MSDN library, but I can't
find out how to get _CrtSetDbgFlag to work as I'd hoped.

As far as I can tell, I need to add the /D "_CRTDBG_MAP_ALLOC" flag to the
Project options on the C/C++ field and add #include <crtdbg.h> to my code.  After
that, by adding:

        tmpFlag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
        tmpFlag |= _CRTDBG_LEAK_CHECK_DF;
        tmpFlag &= _CRTDBG_CHECK_CRT_DF;
        _CrtSetDbgFlag( tmpFlag );
to my code, I should be able to automatically check for memory leaks and the

However, I keep getting compiler errors in malloc.h.  I tried leaving out
different #include files (like stdlib.h, etc.) and varying the order of includes,
but to no avail.  

I'm sure I'm missing something obvious . . . if anyone could tell me what, I'd be
eternally greatful!  

Anyone have any suggestions?

Thanks for any help,

Tim Reiner

Mon, 29 Sep 2003 17:14:17 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Heap Problems: Both Debug and non-Debug versions of CRT are active

2. HEAP[dllhost.exe]: HEAP: Free Heap block 1e32c28 modified at 1e32dc4 after it was freed

3. Debugging the C++ heap

4. HEAP debug messages

5. HEAP Debug Messages

6. How to turn off debug heap checking?

7. Debugging the heap

8. CRT heap, debug configurations, and WS2_32.DLL

9. Turn of debug info in heap

10. HEAP debug message

11. incorrect debug heap messages in 4.2?

12. Help needed with debug heap error


Powered by phpBB® Forum Software