Re: strange memory leak problem



This string will be freed when the variable leaves scope. What is the evidence that this
is leaking memory (if you're relying on CrtMemCheckPoint, know that it doesn't work. See
my essay on this problem on my MVP Tips site).
joe
On Thu, 30 Aug 2007 03:21:09 -0000, mdk <leun98@xxxxxxxxx> wrote:

Hi all,

I use _CrtSetBreakAlloc to break the code at the point the leaking
memory is allocated and find that it is a CString allocated locally
within a function.

void Myclass::PrintInfo(CString &strTmp)
{
......
CString strUser( "bah");
strTmp.Format(IDS_START_INFO, strUser,);
.....
}

Additionally I have found some other memory leaks occur in STL stream
API calls, like << >>.
Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.



Relevant Pages

  • Re: realloc() implicit free() ?
    ... ># whether one is leaking memory. ... of library routines so as to remove the ambiguity. ... In the case of realloc(), ...
    (comp.lang.c)
  • "Simple" animation in C# --> memory leaks???
    ... I am trying to write a "simple" animation using C#, ... things but nothing seems to work for me without leaking memory. ... "sprites" where one gets painted to the buffer each tick and the buffer ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: realloc() implicit free() ?
    ... # whether one is leaking memory. ... that one might have overlooked or which might have been clarified in addendums that one hasn't seen, which proscribe the behaviour of library routines so as to remove the ambiguity. ... In the case of realloc(), since it is never -required- that the address be left unchanged, one can write a replacement for reallocin terms of malloc, a memory copy, and a free, provided that one knows the current size of the object at hand. ...
    (comp.lang.c)
  • Re: is this a memory leak ?
    ... > We were suspecting that our driver is some how leaking memory, ... > (in our driver we use only kmalloc for memroy allocation) but what we ... > recover memory, ie at the time of the OOM killer if the free memory ... Right, if the kernel is leaking memory, the only ...
    (comp.os.linux.development.system)
  • Re: what kind of command or tool is good to check memory leaking?
    ... somez72 came up with this when s/he headbutted the keyboard a moment ago in ... I made simple linux application. ... I'd like to check whether if application is leaking memory or not? ...
    (comp.os.linux.misc)