supaphon / ticpp

Automatically exported from code.google.com/p/ticpp
0 stars 0 forks source link

Memory leaks using Node::InsertEndChild() #17

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
# What steps will reproduce the problem?

    Document doc;
    Element elem("Element");
    doc.InsertEndChild(elem);

# What is the expected output? What do you see instead?

I would expect, that no memory leaks are occuring. Instead I see two
objects created at ticpp.cpp(1084, TiCppRC::TiCppRC()) and one created at
ticpp.cpp(881, Element::Element()).

# What version of the product are you using? On what operating system?

Version 2.5.3. Windows XP, VS2005.

# Please provide any additional information below.

I think the reference count of addThis in Node::InsertEndChild() must not
be incremented (remove "addThis.m_impRC->IncRef();"). As far as I
understand, an independend copy is created in TiXmlNode::InsertEndChild()
with TiXmlNode* node = addThis.Clone(); ?

At least in my project it helped ;-)

Original issue reported on code.google.com by Ulf.Mei...@gmail.com on 24 Feb 2008 at 8:30

GoogleCodeExporter commented 8 years ago
I confirm that this apparently fixes the memory leak on Linux as well (using 
valgrind)

Original comment by benjamin...@gmail.com on 5 Jun 2008 at 9:33

GoogleCodeExporter commented 8 years ago
I think this is a quick fix and should be done soon. Thoughts?

Original comment by rpusz...@gmail.com on 26 Jun 2008 at 3:37

GoogleCodeExporter commented 8 years ago
rjmyst3,
I can make this change if you agree.

Original comment by rpusz...@gmail.com on 26 Jun 2008 at 3:44

GoogleCodeExporter commented 8 years ago
lets do it

Original comment by rjmy...@gmail.com on 26 Jun 2008 at 11:17

GoogleCodeExporter commented 8 years ago
svn r93

Original comment by rjmy...@gmail.com on 17 Jul 2008 at 2:23