Re: string memory leak?
- From: "navels" <navels@xxxxxxxxx>
- Date: 15 Aug 2006 08:54:28 -0700
Carl Daniel [VC++ MVP] wrote:
navels wrote:
I've been battling a memory leak in a C++ console app for some time.
I
have finally tracked down the source by using the Microsoft tool umdh
for dumping the heap. I seem to be unable to reproduce the problem in
a small code snippet. Hopefully I can post enough information here to
make sense to folks.
BTW, I am compiling with Visual C++ 6.0.
Have you applied the STL patches available from
https://www.dinkumware.com/vc_fixes.html
??
If not, you should. Pay particular attention to the fixes to <xstring>
-cd
Ahhhh, thanks. I needed to make std::string thread-safe. There is
more information about this problem here:
http://support.microsoft.com/default.aspx?scid=kb;en-us;813810
I still have one more leak that has something to do with std::string.
I am surprised that the dinkumware fixes did not address this leak as
well. Here is the output from umdh for that one:
000000B0 bytes in 0x1 allocations (@ 0x00000050 + 0x00000018) by:
BackTrace00646
ntdll!RtlDebugAllocateHeap+000000E1
ntdll!RtlAllocateHeapSlowly+00000044
ntdll!RtlAllocateHeap+00000E64
server!_heap_alloc_base+0000013C (malloc.c, 200)
server!_heap_alloc_dbg+000001A2 (dbgheap.c, 378)
server!_nh_malloc_dbg+00000049 (dbgheap.c, 248)
server!_nh_malloc+00000016 (dbgheap.c, 197)
server!operator new+0000000F (new.cpp, 24)
server!std::_Allocate+0000002E (c:\program files\microsoft
visual studio\vc98\include\xmemory, 30)
server!std::allocator<char>::allocate+00000028 (c:\program
files\microsoft visual studio\vc98\include\xmemory, 59)
server!std::basic_string<char,std::char_traits<char>,std::allocator<char>
::_Copy+00000069 (c:\program files\microsoft visual studio\vc98\include\xstring, 540)
server!std::basic_string<char,std::char_traits<char>,std::allocator<char>
::_Grow+00000128 (c:\program files\microsoft visual studio\vc98\include\xstring, 586)
server!std::basic_string<char,std::char_traits<char>,std::allocator<char>
::assign+0000012C (c:\program files\microsoft visual studio\vc98\include\xstring, 142)
server!std::basic_string<char,std::char_traits<char>,std::allocator<char>
::basic_string<char,std::char_traits<char>,std::allocator<char> >+00000045 (c:\program files\microsoft visual studio\vc98\include\xstring, 58)server!ClientParam::ClientParam+0000005B (server.cxx, 59)
server!server+000004E6 (server.cxx, 200)
server!main+00000153 (servermain.cpp, 47)
server!mainCRTStartup+000000FC (crt0.c, 206)
kernel32!BaseProcessStart+00000023
I am upgrading to Visual Studio 2005 at the moment and will report back
if that fixes things.
Thanks again,
Lee
.
- Follow-Ups:
- Re: string memory leak?
- From: navels
- Re: string memory leak?
- References:
- string memory leak?
- From: navels
- Re: string memory leak?
- From: Carl Daniel [VC++ MVP]
- string memory leak?
- Prev by Date: Re: string memory leak?
- Next by Date: Re: string memory leak?
- Previous by thread: Re: string memory leak?
- Next by thread: Re: string memory leak?
- Index(es):
Relevant Pages
|