Quote:Original post by leelouchQuote:Original post by Tunah
How are you stopping your program if you have an infinite loop at the end? Try just running that last loop a couple of hundred times and let the program terminate itself.
Otherwise, ticpp::Document xml won't go out of scope and be destroyed. You're probably just seeing memory that was allocated by the Document-object, but its destructor isn't called when your terminate the program with Ctrl-C.
That's my guess anyway.
This is just an example !
Let's say that xml is a global variable and I do not want to destroy it and reload it again on each time I need an attribute or something else.
The while statement here is only to simulate several access to the xml document ! Access to xml database must not reallocate a new element on each time you access to it. it must have like a cache on element already allocated and return cached pointer.
the while loop must not create an infinite allocation behavior. memory allocation size must remains constant during the loop where here is not the case !
Fair enough, I guess. But you posted example code and valgrind output after it, so it's only logical to assume that you ran it like that.