This is a multi-part message in MIME format.
------=_NextPart_000_0092_01C491EB.2250F6D0
Content-Type: text/plain;
charset="gb2312"
Content-Transfer-Encoding: quoted-printable
In my system, before this piece of code, the memory occupied by my =
program is 770k, and after it is 1550k.
As Scoot says, this is not a sign of memory leak. All of the things is =
just alright including your code. Perhaps you should review your program =
and try to find other possible reasons.
ATField
"Omar Javed" <Omar Javed@discussions.microsoft.com> wrote in message =
news:4FAD2FEA-4816-4FEC-95CF-35C2B6F0873B@microsoft.com...
AoA=20
I have used standard template library in one of my =
applications. I=20
belive that memory leaks are due to stl components, mainly string. i =
wrote a=20
sample program in VC 6.0 that clearly shows memory leaks in stl=20
wstring str =3D L"";=20
for( int a =3D 0 ; a < 100000 ; a++ )=20
{=20
str +=3D L"int";=20
}=20
str.str.erase( str.begin() , str.end() );=20
str =3D L"int";=20
i wrote this code against a button in dialog based application. Before =
clicking the button, the memory usage is 3MB and after this code it is =
17MB=20
although i believe it should have been back to 3MB after the statement =
str.erase( str.begin() , str.end() ).=20
My other observation is that if i exit the application in debug mode =
it=20
tells almost everything about the memory leaks except for the file =
from which=20
memory was allocated. I copied a code that would tell the file but it =
would=20
all leaks are from crtdbg.h=20
anyone plz give me a solution to this.any help in this regard will be =
highly=20
appreciated.=20
P.S. I have been using Task Manager to see how much memory is bieng =
used by=20
my application.=20
Regards=20
Omar Javed
------=_NextPart_000_0092_01C491EB.2250F6D0
Content-Type: text/html;
charset="gb2312"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; charset=3Dgb2312">
<META content=3D"MSHTML 6.00.2800.1458" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>In my system, before this piece of =
code, the=20
memory occupied by my program is 770k, and after it is =
1550k.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>As Scoot says, this is not a sign of =
memory leak.=20
All of the things is just alright including your code. Perhaps you =
should=20
review your program and try to find other possible=20
reasons.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>ATField</FONT></DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Omar Javed" <Omar <A=20
=
href=3D"mailto:Javed@discussions.microsoft.com">Javed@discussions.microso=
ft.com</A>>=20
wrote in message <A=20
=
href=3D"news:4FAD2FEA-4816-4FEC-95CF-35C2B6F0873B@microsoft.com">news:4FA=
D2FEA-4816-4FEC-95CF-35C2B6F0873B@microsoft.com</A>...</DIV>AoA=20
<BR> I have used standard =
template=20
library in one of my applications. I <BR>belive that memory leaks are =
due to=20
stl components, mainly string. i wrote a <BR>sample program in VC 6.0 =
that=20
clearly shows memory leaks in stl <BR><BR>wstring str =3D L""; =
<BR> for(=20
int a =3D 0 ; a < 100000 ; a++ ) <BR> { <BR> str =
+=3D L"int";=20
<BR> } <BR> str.str.erase( str.begin() , str.end() ); =
<BR> =20
str =3D L"int"; <BR><BR>i wrote this code against a button in dialog =
based=20
application. Before <BR>clicking the button, the memory usage is 3MB =
and after=20
this code it is 17MB <BR>although i believe it should have been back =
to 3MB=20
after the statement <BR>str.erase( str.begin() , str.end() ). =
<BR><BR>My other=20
observation is that if i exit the application in debug mode it =
<BR>tells=20
almost everything about the memory leaks except for the file from =
which=20
<BR>memory was allocated. I copied a code that would tell the file but =
it=20
would <BR>all leaks are from crtdbg.h <BR><BR>anyone plz give me a =
solution to=20
this.any help in this regard will be highly <BR>appreciated. <BR>P.S. =
I have=20
been using Task Manager to see how much memory is bieng used by <BR>my =
application. <BR>Regards <BR>Omar Javed</BLOCKQUOTE></BODY></HTML>
------=_NextPart_000_0092_01C491EB.2250F6D0--