Hello All, me again


I develop MFC Extension DLL and I have an problem with Memory leaks issue. I try
to use the The User-Mode Dump Heap (UMDH) tool, Umdh.exe that come with Microsoft debugging tools


After I used umdh.exe to checked the Heap I found this


+ 111536 ( 491024 - 379488) 12246 allocs BackTrace33AD
+ 2778 ( 12246 - 9468) BackTrace33AD allocations

ntdll!RtlpNtMakeTemporaryKey+000074CE
ntdll!LdrAlternateResourcesEnabled+00002B05
ntdll!RtlDosSearchPath_Ustr+00000310
MSVCR90!malloc+00000079
MSVCR90!operator new+0000001F
MSVCP90!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::data+00000157
MSVCP90!std::allocator<char>::allocate+0000000F
MSVCP90!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Copy+00000055
MSVCP90!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Grow+00000026
MSVCP90!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::assign+00000050
MSVCP90!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::assign+00000011
MyDLL!CCallSumData::CCallSumData+00000E0A (x:\projects\folder\branchs\folder2008\folder2008_newway\source\callsummarydata.cpp, 333)

and I look into the line of code and found this

callNum = source.callNum;


Where

public:
string callnum;



the line of code is in the copy constructor.


and the all code it's something like below




CCallSumData::CCallSumData(CCallSumData& source)
{
//some code here

callNum = source.callNum;

//some code here
}



the above copy constructor is call from below:




void CContext::Add(CCallSumData& call)
{



CCallSumData* pCopy = new CCallSumData(call);
m_vVector.insert(m_vVector.begin(), pCopy);

}




and It have 'Remove()' function to 'delete pCopy' in the CContext class.
the m_vVector is a Vector to keep the CCallsumData object to use later.



and I try to check and look at the header file of std::string (xstring.h). I see from stack trace it's call _Grow() and _Copy and I
try to set the 'reserve' at the initialize time but it not help
and I also try to call ~basic_string() to clean up/release resource but it did not help also.

Any one have any idea? Any suggestion are welcome.


Thanks,
Sirichai