Merge pull request #620 from Dmitry-Me/clarifyComment

Clarify comment
This commit is contained in:
Lee Thomason 2017-09-14 10:33:15 -07:00 committed by GitHub
commit bdad8d73a3
1 changed files with 11 additions and 10 deletions

View File

@ -1939,17 +1939,18 @@ int main( int argc, const char ** argv )
// //
// Previously (buggy): // Previously (buggy):
// The memory would be free'd when the XMLDocument is // The memory would be free'd when the XMLDocument is
// destructed. But the destructor wasn't called, so that // destructed. But the XMLElement destructor wasn't called, so
// memory allocated by the XMLElement would not be free'd. // memory allocated for the XMLElement text would not be free'd.
// In practice this meant strings allocated by the XMLElement // In practice this meant strings allocated for the XMLElement
// would leak. An edge case, but annoying. // text would be leaked. An edge case, but annoying.
// Now: // Now:
// The destructor is called. But the list of unlinked nodes // The XMLElement destructor is called. But the unlinked nodes
// has to be tracked. This has a minor performance impact // have to be tracked using a list. This has a minor performance
// that can become significant if you have a lot. (But why // impact that can become significant if you have a lot of
// would you do that?) // unlinked nodes. (But why would you do that?)
// The only way to see this bug is in a leak tracker. This // The only way to see this bug was in a Visual C++ runtime debug heap
// is compiled in by default on Windows Debug. // leak tracker. This is compiled in by default on Windows Debug and
// enabled with _CRTDBG_LEAK_CHECK_DF parameter passed to _CrtSetDbgFlag().
{ {
XMLDocument doc; XMLDocument doc;
doc.NewElement("LEAK 1"); doc.NewElement("LEAK 1");