Groups | Blog | Home
all groups > visual c libraries > october 2005 >

visual c libraries : re: Memory leaks


Alex Thaman
10/4/2005 9:04:04 AM
Can you also post the code you are using to generate the debug report?

-----Original Message-----
From: Nitin@discussions.microsoft.com
Posted At: Thursday, August 25, 2005 9:55 AM
Posted To: microsoft.public.dotnet.languages.vc.libraries
Conversation: Memory leaks
Subject: Memory leaks


The following code shows me a memory leak of 44 bytes:
Can you please explain why I am getting this problem?

#include <iostream>
using namespace std;

int main()
{
cout << sizeof(int);
}

I am using the VC++6.0 compiler and the CRT Debugging routines give me the
following dump:
0 bytes in 0 Free Blocks.
44 bytes in 5 Normal Blocks.
16 bytes in 0 CRT Blocks.
0 bytes in 0 Ignore Blocks.
0 bytes in 0 Client Blocks.
Largest number used: 890 bytes.
Total allocations: 5286 bytes.
Dumping objects ->
c:\program files\microsoft visual studio\vc98\include\crtdbg.h(552) : {60}
normal block at 0x002F27D0, 5 bytes long.
Data: <true > 74 72 75 65 00
c:\program files\microsoft visual studio\vc98\include\crtdbg.h(552) : {59}
normal block at 0x002F2788, 6 bytes long.
Data: <false > 66 61 6C 73 65 00
c:\program files\microsoft visual studio\vc98\include\crtdbg.h(552) : {58}
normal block at 0x002F2740, 1 bytes long.
Data: < > 00
c:\program files\microsoft visual studio\vc98\include\crtdbg.h(552) : {53}
normal block at 0x002F07B8, 24 bytes long.
Data: < F @'/ . > 9C E3 46 00 01 00 00 00 40 27 2F 00 2E 00 CD CD
c:\program files\microsoft visual studio\vc98\include\crtdbg.h(552) : {47}
normal block at 0x002F10C8, 8 bytes long.
Data: <| F > 7C E3 46 00 01 00 00 00
Object dump complete.


sergega4 NO[at]SPAM yahoo.fr
10/9/2005 4:03:02 PM
In general clicking on the
"> normal block at 0x002F27D0, 5 bytes long." line in te output part, this
will drive you to the place where the not destructed dyn memory have been
instanciated.

The good rule to deal with when using dyn memo is to create a booleen (bool)
turned "true" when allocating dynamically, and testing it when exiting (for
instance in destructor) or refreshing your data to send or not the delete.

Xav

[quoted text, click to view]
AddThis Social Bookmark Button