Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

Memory leaks using Node::InsertEndChild() #17

Closed
GoogleCodeExporter opened this issue Mar 17, 2015 · 5 comments
Closed

Memory leaks using Node::InsertEndChild() #17

GoogleCodeExporter opened this issue Mar 17, 2015 · 5 comments

Comments

@GoogleCodeExporter
Copy link

# 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
Copy link
Author

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
Copy link
Author

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

  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Author

rjmyst3,
I can make this change if you agree.

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

@GoogleCodeExporter
Copy link
Author

lets do it

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

@GoogleCodeExporter
Copy link
Author

svn r93

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

  • Changed state: Fixed

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant