I am writing C++ code for Windows (win32 console) to determine when the active window changes (using VS C++ 2008). Using the Windows task manager, I can see that the application leaks a little memory the first time a new window is accessed. I have used several techniques to determine where the memory is leaking but I haven't been able to identify the source. Most tools don't report a leak at all but Task manager says otherwise. The amount of memory that leaks is not consistent (usually 8 or 12Kb per window change) and it does not correlate to the size of the window title.
Can anyone spot my error? Many thanks to anyone who can help - this is driving my batty :)
Most memory leaks are pretty obvious, they'll steadily consume unnecessarily large amounts of memory until the program is killed. (Most leaks I've created consumed hundreds of megs rather quickly.) Also, as was previously stated, memory leaks are impossible without dynamic allocation of objects, so your program is using memory as it should. Memory usage isn't a bad thing; if you need to use memory, you need to use memory.