Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Detecting memory leaks using _CrtDumpMemoryLeaks

hjazzhjazz Posts: 2Member
Hi,

This is my first time using the CRT library for detecting memory leaks, and I'm using Visual C++ 2003. As mentioned in this [link=http://msdn.microsoft.com/en-us/library/x98tx3cf.aspx]website[/link], I included the statements in my program

[code]#define _CRTDBG_MAP_ALLOC
#include
#include [/code]

followed by another header file that contains all other header files like stdio.h, windows.h and structure/function declarations. I also have

[code]_CrtDumpMemoryLeaks();[/code]

right before my function returns.

When I tried to build my program, I get the errors

[code]error C2059: syntax error: 'constant'
error C2059: syntax error: 'string'
error C2733: second C linkage of overloaded function '_aligned_malloc_dbg' not allowed[/code]

for the function prototypes in malloc.h, e.g.

[code]_CRTIMP void * __cdecl calloc(size_t, size_t);
_CRTIMP void * __cdecl free(void *);[/code]

etc.

How do I run the memory check debugger correctly?

Thank you.

Regards,
Rayne
Sign In or Register to comment.