[Qt-interest] Question about detecting memory leaks!
Oliver.Knoll at comit.ch
Oliver.Knoll at comit.ch
Wed Dec 15 16:16:33 CET 2010
On 2010-12-15 Jason Jason H wrote:
> ...
> int* a = new int;
> *a = 1;
> When I start the app in debug-mode within VS2008 and finish the app
> correctly by clicking the windows system menu then the output window
> of VS2008 shows only some text like:
[...]
Maybe I am missing something here, but unless you run your application in some special "memory leak detection debugger" (something like valgrind on Linux) you *won't* get any hints whether your application leaks memory! So the fact that you *don't* get the "Detected memory leaks!" message (where does that come from anyway?) is what I would expect.
> When I use the snipped code above in a simple MFC application and run
> it in debug-mode and close it then the following text is showed by
> output window of VS2008:
Now it could be that VS2008 has some simple memory leak detection (the last version I used was VS2005, and I would not know of such a memory leak detection functionality - then again I was only using the Express version anyway. The fact that you are able to compile MFC project tells me that you are using at least the professional VS version) functionality which you enabled when creating an MFC project. So if there was such a compiler switch, you have to search through all project options and compare those between your MFC and Qt project!
On the other hand it could also be that the "MFC runtime/support libraries" do have some support for detecting memory leaks (honestly, I have no clue - I always tried to avoid MFC like the pest ;)
In any case, memory leak detection doesn't normally come "out of the box". You have to enable it "somewhere", but for sure Qt would not prevent leaks from being detected.
Cheers, Oliver
--
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22
More information about the Qt-interest-old
mailing list