0
votes

I have a C++ application developed on Visual Studio 2008 On the following code I get a memory leaks like:

f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {8386} normal block at 0x11BF9DB0, 25 bytes long. Data: < 3C 4E 4B 55 08 00 00 00 08 00 00 00 01 00 00 00

I have tried many versions, and sure that there is no memory leak here. Is it a defect in CString? How can I by-pass this?

void fff(CString &s1,CString &s2)
{
    int  nSize =100;
    TCHAR *xx = new TCHAR[100];
    ::GetEnvironmentVariable( s1, xx, nSize );
    CString sss(xx);
    s2 = sss;
    delete[] xx;
}

I also get many such leaks on a freshly created MFC application

1
Please present your code. - Ben Crowhurst
How can whe help if there is no code? - rullof
We're talking about millions of lines here... - DuduArbel
The point is that this is something to do with MFC - and not specific to my code. - DuduArbel
When you install Visual Studio, there is an option to install runtime source code also. This includes the MFC source code so you can see what strcore.cpp is doing. - brian beuning

1 Answers

0
votes

Try Visual Leak Detector for Visual C++ 2008/2010/2012.

https://vld.codeplex.com/

It will give you the exact location where memory leaks.