Re: string memory leak?

Tech-Archive recommends: Fix windows errors by optimizing your registry




navels wrote:
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:
[snip]

Follow up: the first leak is not present in VS 2005, as expected. The
second leak is. Based on what I've gleaned from other posts in this
group, it is a safe bet that I'm at fault for that one, so I'll take a
closer look at the code.

Thanks again,
Lee

.



Relevant Pages

  • Re: string memory leak?
    ... have finally tracked down the source by using the Microsoft tool umdh ... I seem to be unable to reproduce the problem in ... 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 ...
    (microsoft.public.vc.stl)
  • Re: Memory Leak with WMI
    ... It is really hard to tell from that small of a code snippet. ... ManagementScope objects theoretically. ... > Why is there a memory leak when this code is executed. ...
    (microsoft.public.dotnet.languages.csharp)