const string leaks?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hello
This is a question about memory leaks, well two actually - one relating to
what memory leak function to use and the other about whether static const
std::strings leak.
Firstly I used the following type code to test for memory leaks:
int main()
{
int retval = 0;
{
//...app's code
}
_CrtDumpMemoryLeaks();
return retval;
}
and it appeared to dump loads of blocks, the data in some I recognised as
the SQL strings I had stored in some std::string members that were static
const members of a class. My question is, does _CrtDumpMemoryLeaks just
identify these as leaks because being static const, they don't go out of
scope till the app ends and thus don't release their memory before _CDML is
called (and if so is there any debugging trick to make them?) - *or*, does a
static const std::string actually have known leaks?

Secondly, what is the difference between using this function and the MFC
CMemoryState object, with its Checkpoint and DumpAllObjectsSince methods,
and which is better and for what reason?

Thanks for any insight!


.



Relevant Pages

  • Re: const string leaks?
    ... int main ... Object dump complete. ... >> This is a question about memory leaks, ... >> members that were static const members of a class. ...
    (microsoft.public.vc.language)
  • Re: const string leaks?
    ... > This is a question about memory leaks, well two actually - one relating to ... > what memory leak function to use and the other about whether static const ... > const members of a class. ...
    (microsoft.public.vc.language)