From a9e75d1b2524fe37ef0788cfbc89d642c47388a8 Mon Sep 17 00:00:00 2001 From: Dmitry-Me Date: Fri, 8 Sep 2017 19:05:23 +0300 Subject: [PATCH] Clarify comment --- xmltest.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/xmltest.cpp b/xmltest.cpp index 59724f7..18e2491 100644 --- a/xmltest.cpp +++ b/xmltest.cpp @@ -1939,17 +1939,18 @@ int main( int argc, const char ** argv ) // // Previously (buggy): // The memory would be free'd when the XMLDocument is - // destructed. But the destructor wasn't called, so that - // memory allocated by the XMLElement would not be free'd. - // In practice this meant strings allocated by the XMLElement - // would leak. An edge case, but annoying. + // destructed. But the XMLElement destructor wasn't called, so + // memory allocated for the XMLElement text would not be free'd. + // In practice this meant strings allocated for the XMLElement + // text would be leaked. An edge case, but annoying. // Now: - // The destructor is called. But the list of unlinked nodes - // has to be tracked. This has a minor performance impact - // that can become significant if you have a lot. (But why - // would you do that?) - // The only way to see this bug is in a leak tracker. This - // is compiled in by default on Windows Debug. + // The XMLElement destructor is called. But the unlinked nodes + // have to be tracked using a list. This has a minor performance + // impact that can become significant if you have a lot of + // unlinked nodes. (But why would you do that?) + // The only way to see this bug was in a Visual C++ runtime debug heap + // leak tracker. This is compiled in by default on Windows Debug and + // enabled with _CRTDBG_LEAK_CHECK_DF parameter passed to _CrtSetDbgFlag(). { XMLDocument doc; doc.NewElement("LEAK 1");