|
-
February 10th, 2011, 01:35 PM
#19
Re: Detecting memory leaks (VC8)
 Originally Posted by John E
What's interesting is that no leak got detected from strTest1 (which was a std::string).
This most likely isn't reporting a leak due to the small string optimization that is done with std::string.
Basically, for strings with 15 characters or less, the data for the string is held directly in the string object (and not allocated separately). So there is no memory leak because no memory was allocated.
If you try this with a longer string, you will probably see a leak for the global std::string when calling _CrtDumpMemoryLeaks() at the bottom of main.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|