Archived

This topic is now archived and is closed to further replies.

owl

ATL - Default memory leak

Recommended Posts

Does ATL come with a predefined memory leak? I created a default ATL project and added a default "ATL Control Class" to it (Windowed Only). I added the folowing handles but with no code on any of them: MESSAGE_HANDLER(WM_SIZE, OnSize) MESSAGE_HANDLER(WM_CREATE, OnCreate) MESSAGE_HANDLER(WM_DESTROY,OnDestroy) MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove) Then I made a simple visual basic EXE project to test it (which has only one form, the ATL control and the default vb controls). Every time I run this vb EXE and close it I notice that my allocated memory has increased about 300k+. Is this normal? Is there any fix for this? Is it me? Does God exist?

Share this post


Link to post
Share on other sites

#define _CRTDBG_MAP_ALLOC
#include <memory.h>
#include <malloc.h>
#include <crtdbg.h>

in your atl project.

_CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG)|_CRTDBG_LEAK_CHECK_DF);

at the beginning of winmain.

watch debug output when you quit the program; if you have any memory leaks, you''ll be told about them.

Share this post


Link to post
Share on other sites