Prev: Unicode compile question
Next: ShellExecute
From: Anwar Khan on 26 Apr 2010 01:25 Hi all, I have a MFC/C++ Application developed. I see a lot of Memory Leaks Dump in the Visual Studio output window when run the app via the debugger. My application consists of an exe, and a few DLLs. The DLLs are loaded by the exe using LoadLibrary. And any memory leaks are in any of the DLLs, there is no info like where in the sourcecode (file name and line number) where the leak was caused. All that I see is the number of bytes of leaked. Whereas, any leak in the EXE shows exact info about file name and line number. Any help/tips/suggestions to help me solve the memory leaks would be highly appreciated. Thanks. Anwar.
From: Faisal on 26 Apr 2010 04:54 On Apr 26, 10:25 am, "Anwar Khan" <anwa...(a)gmail.com> wrote: > Hi all, > > I have a MFC/C++ Application developed. I see a lot of Memory Leaks Dump in > the Visual Studio output window when run the app via the debugger. > > My application consists of an exe, and a few DLLs. The DLLs are loaded by > the exe using LoadLibrary. > > And any memory leaks are in any of the DLLs, there is no info like where in > the sourcecode (file name and line number) where the leak was caused. All > that I see is the number of bytes of leaked. > Whereas, any leak in the EXE shows exact info about file name and line > number. > > Any help/tips/suggestions to help me solve the memory leaks would be highly > appreciated. > > Thanks. > Anwar. if your dlls are MFC dlls, you can enable the memoryleak reporting with file and line number by adding below lines in your .cpp files #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif
From: Anwar Khan on 26 Apr 2010 07:04 "Faisal" <faisalm83(a)gmail.com> wrote in message news:6f626e86-aab3-460b-ac7b-6e3db2ce2d59(a)y38g2000prb.googlegroups.com... On Apr 26, 10:25 am, "Anwar Khan" <anwa...(a)gmail.com> wrote: > Hi all, > > I have a MFC/C++ Application developed. I see a lot of Memory Leaks Dump > in > the Visual Studio output window when run the app via the debugger. > > My application consists of an exe, and a few DLLs. The DLLs are loaded by > the exe using LoadLibrary. > > And any memory leaks are in any of the DLLs, there is no info like where > in > the sourcecode (file name and line number) where the leak was caused. All > that I see is the number of bytes of leaked. > Whereas, any leak in the EXE shows exact info about file name and line > number. > > Any help/tips/suggestions to help me solve the memory leaks would be > highly > appreciated. > > Thanks. > Anwar. if your dlls are MFC dlls, you can enable the memoryleak reporting with file and line number by adding below lines in your .cpp files #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif Hi Faisal, I have tried this. And with VS2008, this is already in place. But, this does not help. The result is the same. -Anwar.
From: Hector Santos on 26 Apr 2010 08:16 Anwar Khan wrote: > "Faisal" <faisalm83(a)gmail.com> wrote in message > news:6f626e86-aab3-460b-ac7b-6e3db2ce2d59(a)y38g2000prb.googlegroups.com... > On Apr 26, 10:25 am, "Anwar Khan" <anwa...(a)gmail.com> wrote: >> Hi all, >> >> I have a MFC/C++ Application developed. I see a lot of Memory Leaks Dump >> in >> the Visual Studio output window when run the app via the debugger. >> >> My application consists of an exe, and a few DLLs. The DLLs are loaded by >> the exe using LoadLibrary. >> >> And any memory leaks are in any of the DLLs, there is no info like where >> in the sourcecode (file name and line number) where the leak was caused. All >> that I see is the number of bytes of leaked. >> Whereas, any leak in the EXE shows exact info about file name and line >> number. >> >> Any help/tips/suggestions to help me solve the memory leaks would be >> highly >> appreciated. >> >> Thanks. >> Anwar. > > if your dlls are MFC dlls, you can enable the memoryleak reporting > with file and line number by adding below lines in your .cpp files > > #ifdef _DEBUG > #define new DEBUG_NEW > #undef THIS_FILE > static char THIS_FILE[] = __FILE__; > #endif > > Hi Faisal, > > I have tried this. And with VS2008, this is already in place. > But, this does not help. The result is the same. > > -Anwar. The only time I seen leak reports without filename, line # locations was when the DLLS: 1) was not compiled with the above pragmas 2) The DLL library was using its own memory manager or macros Note, it doesn't have to be MFC library to use the above. Remember, getting a location is because of the macro replacements of new, malloc, calloc, etc, to wrap it with the FILE and LINE number pragmas. So you won't see these unless the dll is compiled for it. -- HLS
From: Cholo Lennon on 26 Apr 2010 09:32
On 26/04/2010 02:25, Anwar Khan wrote: > Hi all, > > I have a MFC/C++ Application developed. I see a lot of Memory Leaks Dump in > the Visual Studio output window when run the app via the debugger. > > My application consists of an exe, and a few DLLs. The DLLs are loaded by > the exe using LoadLibrary. > > And any memory leaks are in any of the DLLs, there is no info like where in > the sourcecode (file name and line number) where the leak was caused. All > that I see is the number of bytes of leaked. > Whereas, any leak in the EXE shows exact info about file name and line > number. > > Any help/tips/suggestions to help me solve the memory leaks would be highly > appreciated. > > Thanks. > Anwar. > > You could try with one of these freeware leak detectors http://www.codeproject.com/KB/applications/visualleakdetector.aspx http://www.codeproject.com/KB/applications/leakfinder.aspx Regards -- Cholo Lennon Bs.As. ARG |